def test_text_line_of_iterable(code: str, language: Language) -> None: tokens = [ Word.of([Reading.of_name("first")]), LanguageShift.of(code), Word.of([Reading.of_name("second")]), LanguageShift.of("%sb"), LoneDeterminative.of([Determinative.of([Reading.of_name("third")])]), Word.of([BrokenAway.open(), Reading.of_name("fourth")]), UnknownNumberOfSigns.of(), BrokenAway.close(), ] expected_tokens = ( Word.of([Reading.of_name("first")], DEFAULT_LANGUAGE), LanguageShift.of(code), Word.of([Reading.of_name("second")], language), LanguageShift.of("%sb"), LoneDeterminative.of([Determinative.of([Reading.of_name("third")])], Language.AKKADIAN), Word.of( [ BrokenAway.open(), Reading.of((ValueToken( frozenset({EnclosureType.BROKEN_AWAY}), ErasureState.NONE, "fourth", ), )).set_enclosure_type(frozenset({EnclosureType.BROKEN_AWAY })), ], DEFAULT_LANGUAGE, ), UnknownNumberOfSigns(frozenset({EnclosureType.BROKEN_AWAY}), ErasureState.NONE), BrokenAway.close().set_enclosure_type( frozenset({EnclosureType.BROKEN_AWAY})), ) line = TextLine.of_iterable(LINE_NUMBER, tokens) assert line.line_number == LINE_NUMBER assert line.content == expected_tokens assert ( line.key == f"TextLine⁞{line.atf}⟨{'⁚'.join(token.get_key() for token in expected_tokens)}⟩" ) assert line.atf == f"1. first {code} second %sb {{third}} [fourth ...]"
def expected_transliteration(language: Language) -> Sequence[Token]: return ( Word.of([Reading.of_name("bu")], language), LanguageShift.of("%es"), Word.of( [ BrokenAway.open(), Reading.of((ValueToken( frozenset({EnclosureType.BROKEN_AWAY}), ErasureState.NONE, "kur", ), )).set_enclosure_type(frozenset({EnclosureType.BROKEN_AWAY })), ], Language.EMESAL, ), UnknownNumberOfSigns(frozenset({EnclosureType.BROKEN_AWAY}), ErasureState.NONE), BrokenAway.close().set_enclosure_type( frozenset({EnclosureType.BROKEN_AWAY})), )
def make_token(self, data, **kwargs): return ValueToken( frozenset(data["enclosure_type"]), data["erasure"], data["value"] )
), { "type": "TextLine", "prefix": "1.", "lineNumber": OneOfLineNumberSchema().dump(LineNumber(1)), "content": OneOfTokenSchema().dump( [ DocumentOrientedGloss.open(), Word.of( [ Reading.of( ( ValueToken( frozenset( {EnclosureType.DOCUMENT_ORIENTED_GLOSS} ), ErasureState.NONE, "bu", ), ) ).set_enclosure_type( frozenset({EnclosureType.DOCUMENT_ORIENTED_GLOSS}) ) ] ).set_enclosure_type( frozenset({EnclosureType.DOCUMENT_ORIENTED_GLOSS}) ), LoneDeterminative.of( [ Determinative.of( [
EnclosureType.DOCUMENT_ORIENTED_GLOSS })), )).set_enclosure_type( frozenset({EnclosureType.DOCUMENT_ORIENTED_GLOSS})), DocumentOrientedGloss.close().set_enclosure_type( frozenset({EnclosureType.DOCUMENT_ORIENTED_GLOSS})), ), ), (( "ku[r ...]", ( Word.of((Reading.of(( ValueToken.of("ku"), BrokenAway.open(), ValueToken( frozenset({EnclosureType.BROKEN_AWAY}), ErasureState.NONE, "r", ), )), )), Word.of(( UnknownNumberOfSigns.of().set_enclosure_type( frozenset({EnclosureType.BROKEN_AWAY})), BrokenAway.close().set_enclosure_type( frozenset({EnclosureType.BROKEN_AWAY})), )).set_enclosure_type(frozenset({EnclosureType.BROKEN_AWAY})), ), )), (( "{k[ur}-X]", (Word.of(( Determinative.of((Reading.of((