Beispiel #1
0
    def test_strwidth_ucs_4(self):
        self.assertEqual(4, plu.strwidth_ucs_4(width_data, 'abcd'))
        self.assertEqual(4, plu.strwidth_ucs_4(width_data, 'AB'))
        if sys.maxunicode < 0x10FFFF:
            raise SkipTest('Can only test strwidth_ucs_4 in UCS-4 Pythons')

        self.assertEqual(1, plu.strwidth_ucs_4(width_data, '\U0001F063'))
Beispiel #2
0
	def test_strwidth_ucs_4(self):
		self.assertEqual(4, plu.strwidth_ucs_4(width_data, 'abcd'))
		self.assertEqual(4, plu.strwidth_ucs_4(width_data, 'AB'))
		if sys.maxunicode < 0x10FFFF:
			raise SkipTest('Can only test strwidth_ucs_4 in UCS-4 Pythons')

		def east_asian_width(ch):
			assert (len(ch) == 1)
			assert ord(ch) == 0x1F48E
			return 'F'

		with replace_attr(plu, 'east_asian_width', east_asian_width):
			# Warning: travis unicodedata.east_asian_width for some reason 
			# thinks this character is 5 symbols wide.
			self.assertEqual(2, plu.strwidth_ucs_4(width_data, '\U0001F48E'))
Beispiel #3
0
    def test_strwidth_ucs_4(self):
        self.assertEqual(4, plu.strwidth_ucs_4(width_data, 'abcd'))
        self.assertEqual(4, plu.strwidth_ucs_4(width_data, 'AB'))
        if sys.maxunicode < 0x10FFFF:
            raise SkipTest('Can only test strwidth_ucs_4 in UCS-4 Pythons')

        def east_asian_width(ch):
            assert (len(ch) == 1)
            assert ord(ch) == 0x1F48E
            return 'F'

        with replace_attr(plu, 'east_asian_width', east_asian_width):
            # Warning: travis unicodedata.east_asian_width for some reason
            # thinks this character is 5 symbols wide.
            self.assertEqual(2, plu.strwidth_ucs_4(width_data, '\U0001F48E'))