def test_CodepointsToUTF16CodeUnitsAndReverse( self ): for line_value, codepoints, code_units in [ ( '', 0, 0 ), ( 'abcdef', 1, 1 ), ( 'abcdef', 2, 2 ), ( 'abc', 4, 4 ), ( '😉test', len( '😉' ), 2 ), ( '😉', len( '😉' ), 2 ), ( '😉test', len( '😉' ) + 1, 3 ), ( 'te😉st', 1, 1 ), ( 'te😉st', 2 + len( '😉' ) + 1, 5 ), ]: with self.subTest( line_value = line_value, codepoints = codepoints, code_units = code_units ): assert_that( lsp.CodepointsToUTF16CodeUnits( line_value, codepoints ), equal_to( code_units ) ) assert_that( lsp.UTF16CodeUnitsToCodepoints( line_value, code_units ), equal_to( codepoints ) )
def CodepointsToUTF16CodeUnitsAndReverse_test(line_value, codepoints, code_units): assert_that(lsp.CodepointsToUTF16CodeUnits(line_value, codepoints), equal_to(code_units)) assert_that(lsp.UTF16CodeUnitsToCodepoints(line_value, code_units), equal_to(codepoints))