From ae09b99d0e3587b432c3deea0e3d48e4b02b05e1 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Fri, 26 Feb 2021 21:06:17 +0100 Subject: [PATCH] Overload the < <= > >= comparison assertion methods. --- irctest/cases.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/irctest/cases.py b/irctest/cases.py index 64a69ba..a3701dd 100644 --- a/irctest/cases.py +++ b/irctest/cases.py @@ -177,6 +177,28 @@ class _IrcTestCase(unittest.TestCase): fail_msg = fail_msg.format(*extra_format, got=got, expects=expects, msg=msg) super().assertNotEqual(got, expects, fail_msg) + def assertGreater(self, got, expects, msg=None, fail_msg=None, extra_format=()): + if fail_msg: + fail_msg = fail_msg.format(*extra_format, got=got, expects=expects, msg=msg) + super().assertGreater(got, expects, fail_msg) + + def assertGreaterEqual( + self, got, expects, msg=None, fail_msg=None, extra_format=() + ): + if fail_msg: + fail_msg = fail_msg.format(*extra_format, got=got, expects=expects, msg=msg) + super().assertGreaterEqual(got, expects, fail_msg) + + def assertLess(self, got, expects, msg=None, fail_msg=None, extra_format=()): + if fail_msg: + fail_msg = fail_msg.format(*extra_format, got=got, expects=expects, msg=msg) + super().assertLess(got, expects, fail_msg) + + def assertLessEqual(self, got, expects, msg=None, fail_msg=None, extra_format=()): + if fail_msg: + fail_msg = fail_msg.format(*extra_format, got=got, expects=expects, msg=msg) + super().assertLessEqual(got, expects, fail_msg) + class BaseClientTestCase(_IrcTestCase): """Basic class for client tests. Handles spawning a client and exchanging