def test_one_double_wide_character(self): self.assertEqual(strcrop('123/456', 0), '') self.assertEqual(strcrop('123/456', 1), '1') self.assertEqual(strcrop('123/456', 2), '12') self.assertEqual(strcrop('123/456', 3), '123') self.assertEqual(strcrop('123/456', 4), '123') self.assertEqual(strcrop('123/456', 5), '123/') self.assertEqual(strcrop('123/456', 6), '123/4') self.assertEqual(strcrop('123/456', 7), '123/45') self.assertEqual(strcrop('123/456', 8), '123/456') self.assertEqual(strcrop('123/456', 9), '123/456')
def test_multiple_double_wide_characters(self): self.assertEqual(strcrop('ツ123/456ツ', 100), 'ツ123/456ツ') self.assertEqual(strcrop('ツ123/456ツ', 1), '') self.assertEqual(strcrop('ツ123/456ツ', 2), 'ツ') self.assertEqual(strcrop('ツ123/456ツ', 3), 'ツ1') self.assertEqual(strcrop('ツ123/456ツ', 4), 'ツ12') self.assertEqual(strcrop('ツ123/456ツ', 5), 'ツ123') self.assertEqual(strcrop('ツ123/456ツ', 6), 'ツ123') self.assertEqual(strcrop('ツ123/456ツ', 7), 'ツ123/') self.assertEqual(strcrop('ツ123/456ツ', 8), 'ツ123/4') self.assertEqual(strcrop('ツ123/456ツ', 9), 'ツ123/45') self.assertEqual(strcrop('ツ123/456ツ', 10), 'ツ123/456') self.assertEqual(strcrop('ツ123/456ツ', 11), 'ツ123/456') self.assertEqual(strcrop('ツ123/456ツ', 12), 'ツ123/456ツ') self.assertEqual(strcrop('ツ123/456ツ', 13), 'ツ123/456ツ')
def test_ascii_string(self): self.assertEqual(strcrop('123456', 100), '123456') self.assertEqual(strcrop('123456', 3), '123') self.assertEqual(strcrop('123456', 0), '')
def test_empty_string(self): self.assertEqual(strcrop('', 0), '') self.assertEqual(strcrop('', 100), '')