From 044d11f9eed543b70af8c57c2d45c6e933bece63 Mon Sep 17 00:00:00 2001 From: Matthias Kramm Date: Wed, 31 Aug 2016 07:27:53 -0700 Subject: [PATCH] clean up unittest.py (#509) * clean up unittest.py Remove duplicates, adjust wrapping. * also remove unittest from pytype blacklist --- stdlib/2.7/unittest.pyi | 38 +++++++++++++++++--------------------- tests/pytype_blacklist.txt | 1 - 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/stdlib/2.7/unittest.pyi b/stdlib/2.7/unittest.pyi index 9c9ba905f..69618e58d 100644 --- a/stdlib/2.7/unittest.pyi +++ b/stdlib/2.7/unittest.pyi @@ -69,23 +69,33 @@ class TestCase(Testable): def assertTrue(self, expr: Any, msg: object = ...) -> None: ... def assertEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... + def assertEquals(self, first: Any, second: Any, + msg: object = ...) -> None: ... def failUnlessEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... def assertNotEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... + def assertNotEquals(self, first: Any, second: Any, + msg: object = ...) -> None: ... def failIfEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... def assertAlmostEqual(self, first: float, second: float, places: int = ..., msg: object = ..., delta: float = ...) -> None: ... - def failUnlessAlmostEqual(self, first: float, second: float, - places: int = ..., + def assertAlmostEquals(self, first: float, second: float, places: int = ..., + msg: object = ..., + delta: float = ...) -> None: ... + def failUnlessAlmostEqual(self, first: float, second: float, places: int = ..., msg: object = ...) -> None: ... - def assertNotAlmostEqual(self, first: float, second: float, - places: int = ..., msg: object = ..., + def assertNotAlmostEqual(self, first: float, second: float, places: int = ..., + msg: object = ..., delta: float = ...) -> None: ... + def assertNotAlmostEquals(self, first: float, second: float, places: int = ..., + msg: object = ..., + delta: float = ...) -> None: ... def failIfAlmostEqual(self, first: float, second: float, places: int = ..., - msg: object = ...) -> None: ... + msg: object = ..., + delta: float = ...) -> None: ... def assertGreater(self, first: Any, second: Any, msg: object = ...) -> None: ... def assertGreaterEqual(self, first: Any, second: Any, @@ -93,8 +103,7 @@ class TestCase(Testable): 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: ... + msg: object = ..., seq_type: type = ...) -> None: ... def assertListEqual(self, first: List[Any], second: List[Any], msg: object = ...) -> None: ... def assertTupleEqual(self, first: Tuple[Any, ...], second: Tuple[Any, ...], @@ -108,6 +117,7 @@ class TestCase(Testable): def assertLessEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... def assertRaises(self, expected_exception: type, *args: Any, **kwargs: Any) -> Any: ... + def failUnlessRaises(self, expected_exception: type, *args: Any, **kwargs: Any) -> Any: ... def failIf(self, expr: Any, msg: object = ...) -> None: ... def assertFalse(self, expr: Any, msg: object = ...) -> None: ... def assertIs(self, first: object, second: object, @@ -134,20 +144,6 @@ class TestCase(Testable): def addCleanup(function: Any, *args: Any, **kwargs: Any) -> None: ... def skipTest(self, reason: Any) -> None: ... - assertEquals = assertEqual - assertNotEquals = assertNotEqual - assertAlmostEquals = assertAlmostEqual - assertNotAlmostEquals = assertNotAlmostEqual - assert_ = assertTrue - - failUnlessEqual = assertEqual - failIfEqual = assertNotEqual - failUnlessAlmostEqual = assertAlmostEqual - failIfAlmostEqual = assertNotAlmostEqual - failUnless = assertTrue - failUnlessRaises = assertRaises - failIf = assertFalse - class CallableTestCase(Testable): def __init__(self, testFunc: Callable[[], None], setUp: Callable[[], None] = ..., diff --git a/tests/pytype_blacklist.txt b/tests/pytype_blacklist.txt index 86f2c7d5f..524cd2d9d 100644 --- a/tests/pytype_blacklist.txt +++ b/tests/pytype_blacklist.txt @@ -8,7 +8,6 @@ 2.7/pydoc.pyi 2.7/types.pyi 2.7/typing.pyi -2.7/unittest.pyi 2.7/xml/dom/minidom.pyi 2and3/argparse.pyi 2and3/logging/handlers.pyi