Skip to content

Commit

Permalink
Merge pull request #224 from RedisLabsModules/meiravg_add_message_to_…
Browse files Browse the repository at this point in the history
…assertion

add optional mesaage to assertions
  • Loading branch information
meiravgri authored Nov 25, 2024
2 parents bff4694 + 3bad3f2 commit a56c01b
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions RLTest/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,32 +472,32 @@ def assertTrue(self, val, depth=0, message=None):
def assertFalse(self, val, depth=0, message=None):
self.assertEqual(bool(val), False, depth + 1, message=message)

def assertContains(self, value, holder, depth=0):
self._assertion('%s should contain %s' % (repr(holder), repr(value)), value in holder, depth)
def assertContains(self, value, holder, depth=0, message=None):
self._assertion('%s should contain %s' % (repr(holder), repr(value)), value in holder, depth, message=message)

def assertNotContains(self, value, holder, depth=0):
self._assertion('%s should not contain %s' % (repr(holder), repr(value)), value not in holder, depth)
def assertNotContains(self, value, holder, depth=0, message=None):
self._assertion('%s should not contain %s' % (repr(holder), repr(value)), value not in holder, depth, message=message)

def assertGreaterEqual(self, value1, value2, depth=0):
self._assertion('%s >= %s' % (repr(value1), repr(value2)), value1 >= value2, depth)
def assertGreaterEqual(self, value1, value2, depth=0, message=None):
self._assertion('%s >= %s' % (repr(value1), repr(value2)), value1 >= value2, depth, message=message)

def assertGreater(self, value1, value2, depth=0):
self._assertion('%s > %s' % (repr(value1), repr(value2)), value1 > value2, depth)
def assertGreater(self, value1, value2, depth=0, message=None):
self._assertion('%s > %s' % (repr(value1), repr(value2)), value1 > value2, depth, message=message)

def assertLessEqual(self, value1, value2, depth=0):
self._assertion('%s <= %s' % (repr(value1), repr(value2)), value1 <= value2, depth)
def assertLessEqual(self, value1, value2, depth=0, message=None):
self._assertion('%s <= %s' % (repr(value1), repr(value2)), value1 <= value2, depth, message=message)

def assertLess(self, value1, value2, depth=0):
self._assertion('%s < %s' % (repr(value1), repr(value2)), value1 < value2, depth)
def assertLess(self, value1, value2, depth=0, message=None):
self._assertion('%s < %s' % (repr(value1), repr(value2)), value1 < value2, depth, message=message)

def assertIsNotNone(self, value, depth=0):
self._assertion('%s is not None' % (repr(value)), value is not None, depth)
def assertIsNotNone(self, value, depth=0, message=None):
self._assertion('%s is not None' % (repr(value)), value is not None, depth, message=message)

def assertIsNone(self, value, depth=0):
self._assertion('%s is None' % (repr(value)), value is None, depth)
def assertIsNone(self, value, depth=0, message=None):
self._assertion('%s is None' % (repr(value)), value is None, depth, message=message)

def assertIsInstance(self, value, instance, depth=0):
self._assertion('%s instance of %s' % (repr(value), repr(instance)), isinstance(value, instance), depth)
def assertIsInstance(self, value, instance, depth=0, message=None):
self._assertion('%s instance of %s' % (repr(value), repr(instance)), isinstance(value, instance), depth, message=message)

def assertAlmostEqual(self, value1, value2, delta, depth=0, message=None):
self._assertion('%s almost equels %s (delta %s)' % (repr(value1), repr(value2), repr(delta)), abs(value1 - value2) <= delta, depth, message)
Expand Down

0 comments on commit a56c01b

Please sign in to comment.