def test_ten_gets_no_comma(self): number = 20 result = human_readable_numbers.humanise_number(number) self.assertEqual(result.locale_string.count(','), 0) self.assertEqual(int(result.locale_string.replace(',', '')), number)
def test_next_over_trillion_gets_five_comma(self): number = 2 * (10**15) result = human_readable_numbers.humanise_number(number) self.assertEqual(result.locale_string.count(','), 5) self.assertEqual(int(result.locale_string.replace(',', '')), number)
def test_ten_thousand_gets_one_comma(self): number = 12345 result = human_readable_numbers.humanise_number(number) self.assertEqual(result.locale_string.count(','), 1) self.assertEqual(int(result.locale_string.replace(',', '')), number)
def test_next_over_trillion_gets_unformatted_magnitude(self): number = 2 * (10**15) result = human_readable_numbers.humanise_number(number) self.assertEqual(result.magnitude_string, '2,000 trillion')
def test_million_gets_one_million_magnitude(self): number = 2000000 result = human_readable_numbers.humanise_number(number) self.assertEqual(result.magnitude_string, '2 million')
def test_thousand_gets_thousand_magnitude(self): number = 2000 result = human_readable_numbers.humanise_number(number) self.assertEqual(result.magnitude_string, '2 thousand')
def test_ten_thousand_gets_thousand_magnitude(self): number = 12345 result = human_readable_numbers.humanise_number(number) self.assertEqual(result.magnitude_string, '12 thousand 3 hundred 45')
def test_hundred_gets_one_hundred_magnitude(self): number = 200 result = human_readable_numbers.humanise_number(number) self.assertEqual(result.magnitude_string, '2 hundred')