def test_all_upto_10000_dialect_old(self): for i in range(10000): j = cu_parse_int(cu_format_int(i, dialect='old')) self.assertEqual(i, j) j = cu_parse_int(cu_format_int(i, add_titlo=False, dialect='old')) self.assertEqual(i, j)
def test_all_upto_10000(self): for i in range(10000): j = cu_parse_int(cu_format_int(i)) self.assertEqual(i, j) j = cu_parse_int(cu_format_int(i, add_titlo=False)) self.assertEqual(i, j)
def test_crazy(self): self.assertEqual( cu_format_int(1234567890123).replace('\xa0', ' '), '҂҂҂҂а҃ ҂҂҂сл҃д ҂҂фѯ҃з ҂ѿч҃ рк҃г') self.assertEqual( cu_format_int(1234567890123, dialect='old').replace('\xa0', ' '), '҂҂҂҂а҃ ҂҂҂сл҃д ҂҂фѯ҃з ҂ѿ҂чрк҃г')
def test_random_dialect_old(self): for _ in range(10000): i = random.randint(10000, 10000000) j = cu_parse_int(cu_format_int(i, dialect='old')) self.assertEqual(i, j) j = cu_parse_int(cu_format_int(i, add_titlo=False, dialect='old')) self.assertEqual(i, j)
def test_random(self): for _ in range(10000): i = random.randint(10000, 10000000) j = cu_parse_int(cu_format_int(i)) self.assertEqual(i, j) j = cu_parse_int(cu_format_int(i, add_titlo=False)) self.assertEqual(i, j)
def test_other(self): self.assertNotEqual(cu_format_int(1010), cu_format_int(11000)) self.assertEqual(cu_format_int(1010), '҂а҃і') self.assertEqual(cu_format_int(11000), '҂а҃҂і') self.assertEqual(cu_format_int(1010, dialect='old'), '҂а҃і') self.assertEqual(cu_format_int(11000, dialect='old'), '҂а҃҂і')
def test_negative(self): self.assertEqual(cu_format_int(-1010), '-҂а҃і') self.assertEqual(cu_format_int(-1010, dialect='old'), '-҂а҃і')
def test_no_titlo(self): self.assertEqual( cu_format_int(11100, add_titlo=False).replace('\xa0', ' '), '҂аі р')
def test_no_titlo(self): self.assertEqual(cu_format_int(11100, add_titlo=False).replace('\xa0', ' '), '҂аі р')
def test_crazy(self): self.assertEqual(cu_format_int(1234567890123).replace('\xa0', ' '), '҂҂҂҂а҃ ҂҂҂сл҃д ҂҂фѯ҃з ҂ѿч҃ рк҃г') self.assertEqual(cu_format_int(1234567890123, dialect='old').replace('\xa0', ' '), '҂҂҂҂а҃ ҂҂҂сл҃д ҂҂фѯ҃з ҂ѿ҂чрк҃г')
def assert_good(self, num, string, dialect='standard'): self.assertEqual( cu_format_int(num, dialect=dialect).replace('\xa0', ' '), string) self.assertEqual(cu_parse_int(string), num)
def assert_good(self, num, string, dialect='standard'): self.assertEqual(cu_format_int(num, dialect=dialect).replace('\xa0', ' '), string) self.assertEqual(cu_parse_int(string), num)