Skip to content

Commit dedfe2d

Browse files
pfalconpi-anl
authored andcommitted
unittest: Add assertLessEqual, assertGreaterEqual methods.
As used by CPython testsuite.
1 parent a57b575 commit dedfe2d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

python-stdlib/unittest/unittest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ def assertNotEqual(self, x, y, msg=""):
4343
msg = "%r not expected to be equal %r" % (x, y)
4444
assert x != y, msg
4545

46+
def assertLessEqual(self, x, y, msg=None):
47+
if msg is None:
48+
msg = "%r is expected to be <= %r" % (x, y)
49+
assert x <= y, msg
50+
51+
def assertGreaterEqual(self, x, y, msg=None):
52+
if msg is None:
53+
msg = "%r is expected to be >= %r" % (x, y)
54+
assert x >= y, msg
55+
4656
def assertAlmostEqual(self, x, y, places=None, msg="", delta=None):
4757
if x == y:
4858
return

0 commit comments

Comments
 (0)