Ejemplo n.º 1
0
 def test__compare_raises_exception_if_arguments_have_invalid_type(self):
     """
     Test that given invalid ``comp``,
     the function raises an ArgumentValueError exception
     """
     with pytest.raises(ArgumentValueError):
         util._compare('foo', 1, 2)
Ejemplo n.º 2
0
 def test__compare_returns_correctly_with_ne_comparator(self):
     """
     Test that given correct values, the function outputs the correct result with 'ne' comparator
     ne = not equal
     """
     ret = util._compare('ne', 1, 2)
     assert ret is True, '1 != 2'
     ret = util._compare('ne', 2, 1)
     assert ret is True, '2 != 1'
     ret = util._compare('ne', 1, 1)
     assert ret is False, '1 != 1'
Ejemplo n.º 3
0
 def test__compare_returns_correctly_with_eq_comparator(self):
     """
     Test that given correct values, the function outputs the correct result with 'eq' comparator
     eq = equal
     """
     ret = util._compare('eq', 1, 2)
     assert ret is False, '1 == 2'
     ret = util._compare('eq', 2, 1)
     assert ret is False, '2 == 1'
     ret = util._compare('eq', 1, 1)
     assert ret is True, '1 == 1'
Ejemplo n.º 4
0
 def test__compare_returns_correctly_with_le_comparator(self):
     """
     Test that given correct values, the function outputs the correct result with 'le' comparator
     le = lower equal
     """
     ret = util._compare('le', 1, 2)
     assert ret is True, '1 <= 2'
     ret = util._compare('le', 2, 2)
     assert ret is True, '2 <= 2'
     ret = util._compare('le', 2, 1)
     assert ret is False, '2 <= 1'
Ejemplo n.º 5
0
 def test__compare_returns_correctly_with_lt_comparator(self):
     """
     Test that given correct values, the function outputs the correct result with 'lt' comparator
     lt = lower than
     """
     ret = util._compare('lt', 1, 2)
     assert ret is True, '1 < 2'
     ret = util._compare('lt', 2, 2)
     assert ret is False, '2 < 2'
     ret = util._compare('lt', 2, 1)
     ret is False, '2 < 1'
Ejemplo n.º 6
0
 def test__compare_returns_correctly_with_gt_comparator(self):
     """
     Test that given correct values, the function outputs the correct result with 'gt' comparator
     gt = greater than
     """
     ret = util._compare('gt', 10, 2)
     assert ret is True, '10 > 2'
     ret = util._compare('gt', 1, 2)
     assert ret is False, '1 > 2'
     ret = util._compare('gt', 2, 2)
     assert ret is False, '2 > 2'
Ejemplo n.º 7
0
 def test__compare_returns_correctly_with_ge_comparator(self):
     """
     Test that given correct values, the function outputs the correct result with 'ge' comparator
     ge = greater equal
     """
     ret = util._compare('ge', 1, 2)
     assert ret is False, '1 >= 2'
     ret = util._compare('ge', 2, 2)
     assert ret is True, '2 >= 2'
     ret = util._compare('ge', 2, 1)
     assert ret is True, '2 >= 1'