Пример #1
0
 def test_negative_number_of_digits(self):
     assert 2400 == xround(2352.67, -2)
Пример #2
0
 def test_coerce_from_string(self):
     assert 2400 == xround("2352.67", "-2")
Пример #3
0
 def test_nb_digits_must_be_number(self):
     assert VALUE_ERROR == xround(2.323, 'ze')
Пример #4
0
 def test_positive_number_of_digits(self):
     assert 2.68 == xround(2.675, 2)
Пример #5
0
def test_xround2(number, digits, result):
    assert result == xround(number, digits)
Пример #6
0
 def test_nb_must_be_number(self):
     assert VALUE_ERROR == xround('er', 1)
Пример #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))
Пример #8
0
 def test_negative_number_of_digits(self):
     self.assertEqual(xround(2352.67, -2), 2400)
Пример #9
0
 def test_positive_number_of_digits(self):
     self.assertEqual(xround(2.675, 2), 2.68)
Пример #10
0
 def test_negative_number_of_digits(self):
     self.assertEqual(xround(2352.67, -2), 2400) 
Пример #11
0
 def test_positive_number_of_digits(self):
     self.assertEqual(xround(2.675, 2), 2.68)