unittest: Add assertLessEqual, assertGreaterEqual methods.

As used by CPython testsuite.
pull/488/head
Paul Sokolovsky 2019-08-13 08:29:50 +03:00 zatwierdzone przez Andrew Leech
rodzic a57b575020
commit dedfe2dcd4
1 zmienionych plików z 10 dodań i 0 usunięć

Wyświetl plik

@ -43,6 +43,16 @@ class TestCase:
msg = "%r not expected to be equal %r" % (x, y)
assert x != y, msg
def assertLessEqual(self, x, y, msg=None):
if msg is None:
msg = "%r is expected to be <= %r" % (x, y)
assert x <= y, msg
def assertGreaterEqual(self, x, y, msg=None):
if msg is None:
msg = "%r is expected to be >= %r" % (x, y)
assert x >= y, msg
def assertAlmostEqual(self, x, y, places=None, msg="", delta=None):
if x == y:
return