From 4a79dec6bab734c2fbf095a92e43d86046ef4f41 Mon Sep 17 00:00:00 2001 From: Philip House Date: Tue, 28 Jun 2016 10:12:27 -0500 Subject: [PATCH] adding type-specific assertEqual cases (#315) Adding support for type-specific equality methods (see https://docs.python.org/2.7/library/unittest.html?highlight=assertlistequals#unittest.TestCase.addTypeEqualityFunc) in the unittest stub for both 2.7/3. As requested by @gvanrossum in #308 --- stdlib/2.7/unittest.pyi | 18 +++++++++++++----- stdlib/3/unittest.pyi | 18 +++++++++++++----- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/stdlib/2.7/unittest.pyi b/stdlib/2.7/unittest.pyi index 665b7b850..a914cec7a 100644 --- a/stdlib/2.7/unittest.pyi +++ b/stdlib/2.7/unittest.pyi @@ -73,9 +73,6 @@ class TestCase(Testable): msg: object = ...) -> None: ... def assertNotEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... - def assertSequenceEqual(self, first: Sequence[Any], second: Sequence[Any], - msg: object = ..., - seq_type: type = ...) -> None: ... def failIfEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... def assertAlmostEqual(self, first: float, second: float, places: int = ..., @@ -92,9 +89,20 @@ class TestCase(Testable): def assertGreater(self, first: Any, second: Any, msg: object = ...) -> None: ... def assertGreaterEqual(self, first: Any, second: Any, - msg: object = ...) -> None: ... + msg: object = ...) -> None: ... + def assertMultiLineEqual(self, first: str, second: str, + msg: object = ...) -> None: ... + def assertSequenceEqual(self, first: Sequence[Any], second: Sequence[Any], + msg: object = ..., + seq_type: type = ...) -> None: ... def assertListEqual(self, first: List[Any], second: List[Any], - msg: object = ...) -> None: ... + msg: object = ...) -> None: ... + def assertTupleEqual(self, first: Tuple[Any, ...], second: Tuple[Any, ...], + msg: object = ...) -> None: ... + def assertSetEqual(self, first: Set[Any], second: Set[Any], + msg: object = ...) -> None: ... + def assertDictEqual(self, first: Dict[Any, Any], second: Dict[Any, Any], + msg: object = ...) -> None: ... def assertLess(self, first: Any, second: Any, msg: object = ...) -> None: ... def assertLessEqual(self, first: Any, second: Any, diff --git a/stdlib/3/unittest.pyi b/stdlib/3/unittest.pyi index b83aee979..8ba8e48c3 100644 --- a/stdlib/3/unittest.pyi +++ b/stdlib/3/unittest.pyi @@ -76,9 +76,6 @@ class TestCase(Testable): msg: object = ...) -> None: ... def assertNotEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... - def assertSequenceEqual(self, first: Sequence[Any], second: Sequence[Any], - msg: object = ..., - seq_type: type = ...) -> None: ... def failIfEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... def assertAlmostEqual(self, first: float, second: float, places: int = ..., @@ -95,9 +92,20 @@ class TestCase(Testable): def assertGreater(self, first: Any, second: Any, msg: object = ...) -> None: ... def assertGreaterEqual(self, first: Any, second: Any, - msg: object = ...) -> None: ... + msg: object = ...) -> None: ... + def assertMultiLineEqual(self, first: str, second: str, + msg: object = ...) -> None: ... + def assertSequenceEqual(self, first: Sequence[Any], second: Sequence[Any], + msg: object = ..., + seq_type: type = ...) -> None: ... def assertListEqual(self, first: List[Any], second: List[Any], - msg: object = ...) -> None: ... + msg: object = ...) -> None: ... + def assertTupleEqual(self, first: Tuple[Any, ...], second: Tuple[Any, ...], + msg: object = ...) -> None: ... + def assertSetEqual(self, first: Set[Any], second: Set[Any], + msg: object = ...) -> None: ... + def assertDictEqual(self, first: Dict[Any, Any], second: Dict[Any, Any], + msg: object = ...) -> None: ... def assertLess(self, first: Any, second: Any, msg: object = ...) -> None: ... def assertLessEqual(self, first: Any, second: Any,