def test_negative_number_of_digits(self): assert 2400 == xround(2352.67, -2)
def test_coerce_from_string(self): assert 2400 == xround("2352.67", "-2")
def test_nb_digits_must_be_number(self): assert VALUE_ERROR == xround(2.323, 'ze')
def test_positive_number_of_digits(self): assert 2.68 == xround(2.675, 2)
def test_xround2(number, digits, result): assert result == xround(number, digits)
def test_nb_must_be_number(self): assert VALUE_ERROR == xround('er', 1)
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))
def test_negative_number_of_digits(self): self.assertEqual(xround(2352.67, -2), 2400)
def test_positive_number_of_digits(self): self.assertEqual(xround(2.675, 2), 2.68)