Example #1
0
 def test_negative_number_of_digits(self):
     assert 2400 == xround(2352.67, -2)
Example #2
0
 def test_coerce_from_string(self):
     assert 2400 == xround("2352.67", "-2")
Example #3
0
 def test_nb_digits_must_be_number(self):
     assert VALUE_ERROR == xround(2.323, 'ze')
Example #4
0
 def test_positive_number_of_digits(self):
     assert 2.68 == xround(2.675, 2)
Example #5
0
def test_xround2(number, digits, result):
    assert result == xround(number, digits)
Example #6
0
 def test_nb_must_be_number(self):
     assert VALUE_ERROR == xround('er', 1)
Example #7
0
def test_xround(result, digits):
    assert result == xround(12345.6789, digits)
    assert result == xround(12345.6789, digits + (-0.9 if digits < 0 else 0.9))
Example #8
0
 def test_negative_number_of_digits(self):
     self.assertEqual(xround(2352.67, -2), 2400)
Example #9
0
 def test_positive_number_of_digits(self):
     self.assertEqual(xround(2.675, 2), 2.68)
Example #10
0
 def test_negative_number_of_digits(self):
     self.assertEqual(xround(2352.67, -2), 2400) 
Example #11
0
 def test_positive_number_of_digits(self):
     self.assertEqual(xround(2.675, 2), 2.68)