From eef07da56a7975f5af6aed32bd50903949cc14f4 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sun, 27 Jun 2021 00:23:07 +0200 Subject: [PATCH] cases: Stop ignoring the 'msg' parameter in assert* methods --- irctest/cases.py | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/irctest/cases.py b/irctest/cases.py index 309e376..bad4a37 100644 --- a/irctest/cases.py +++ b/irctest/cases.py @@ -185,10 +185,8 @@ class _IrcTestCase(unittest.TestCase, Generic[TController]): extra_format: Tuple = (), ) -> None: if fail_msg: - fail_msg = fail_msg.format( - *extra_format, item=member, list=container, msg=msg - ) - super().assertIn(member, container, fail_msg) + msg = fail_msg.format(*extra_format, item=member, list=container, msg=msg) + super().assertIn(member, container, msg) def assertNotIn( self, @@ -199,10 +197,8 @@ class _IrcTestCase(unittest.TestCase, Generic[TController]): extra_format: Tuple = (), ) -> None: if fail_msg: - fail_msg = fail_msg.format( - *extra_format, item=member, list=container, msg=msg - ) - super().assertNotIn(member, container, fail_msg) + msg = fail_msg.format(*extra_format, item=member, list=container, msg=msg) + super().assertNotIn(member, container, msg) def assertEqual( self, @@ -213,8 +209,8 @@ class _IrcTestCase(unittest.TestCase, Generic[TController]): extra_format: Tuple = (), ) -> None: if fail_msg: - fail_msg = fail_msg.format(*extra_format, got=got, expects=expects, msg=msg) - super().assertEqual(got, expects, fail_msg) + msg = fail_msg.format(*extra_format, got=got, expects=expects, msg=msg) + super().assertEqual(got, expects, msg) def assertNotEqual( self, @@ -225,8 +221,8 @@ class _IrcTestCase(unittest.TestCase, Generic[TController]): extra_format: Tuple = (), ) -> None: if fail_msg: - fail_msg = fail_msg.format(*extra_format, got=got, expects=expects, msg=msg) - super().assertNotEqual(got, expects, fail_msg) + msg = fail_msg.format(*extra_format, got=got, expects=expects, msg=msg) + super().assertNotEqual(got, expects, msg) def assertGreater( self, @@ -237,8 +233,8 @@ class _IrcTestCase(unittest.TestCase, Generic[TController]): extra_format: Tuple = (), ) -> None: if fail_msg: - fail_msg = fail_msg.format(*extra_format, got=got, expects=expects, msg=msg) - super().assertGreater(got, expects, fail_msg) + msg = fail_msg.format(*extra_format, got=got, expects=expects, msg=msg) + super().assertGreater(got, expects, msg) def assertGreaterEqual( self, @@ -249,8 +245,8 @@ class _IrcTestCase(unittest.TestCase, Generic[TController]): extra_format: Tuple = (), ) -> None: if fail_msg: - fail_msg = fail_msg.format(*extra_format, got=got, expects=expects, msg=msg) - super().assertGreaterEqual(got, expects, fail_msg) + msg = fail_msg.format(*extra_format, got=got, expects=expects, msg=msg) + super().assertGreaterEqual(got, expects, msg) def assertLess( self, @@ -261,8 +257,8 @@ class _IrcTestCase(unittest.TestCase, Generic[TController]): extra_format: Tuple = (), ) -> None: if fail_msg: - fail_msg = fail_msg.format(*extra_format, got=got, expects=expects, msg=msg) - super().assertLess(got, expects, fail_msg) + msg = fail_msg.format(*extra_format, got=got, expects=expects, msg=msg) + super().assertLess(got, expects, msg) def assertLessEqual( self, @@ -273,8 +269,8 @@ class _IrcTestCase(unittest.TestCase, Generic[TController]): extra_format: Tuple = (), ) -> None: if fail_msg: - fail_msg = fail_msg.format(*extra_format, got=got, expects=expects, msg=msg) - super().assertLessEqual(got, expects, fail_msg) + msg = fail_msg.format(*extra_format, got=got, expects=expects, msg=msg) + super().assertLessEqual(got, expects, msg) class BaseClientTestCase(_IrcTestCase[basecontrollers.BaseClientController]):