def __init__(self): super().__init__() self.max_keyword = MAXIMUM_KEYWORD self.max_function = MAXIMUM_FUNCTION self.name = "Dragon Tokens" self.keyword_dictionary = invert_dictionary( self.keyword_token_dictionary) self.function_dictionary = invert_dictionary( self.function_token_dictionary)
def __init__(self): self.state = KEYWORD self.max_keyword = MAXIMUM_KEYWORD self.max_function = MAXIMUM_FUNCTION self.name = "Empty tokens" self.keyword_dictionary = invert_dictionary( self.keyword_token_dictionary) self.function_dictionary = invert_dictionary( self.function_token_dictionary)
def __init__(self): super().__init__() self.keyword_token_dictionary = { **self.keyword_token_dictionary, **self.dos_keyword_token_dictionary } self.function_token_dictionary = { **self.function_token_dictionary, **self.dos_function_token_dictionary } self.max_keyword = MAXIMUM_DOS_KEYWORD self.max_function = MAXIMUM_DOS_FUNCTION self.name = "Coco Extended RSDOS tokens" self.keyword_dictionary = invert_dictionary( self.keyword_token_dictionary) self.function_dictionary = invert_dictionary( self.function_token_dictionary)
def test_given_an_empty_dictionary_invert_dictionary_returns_empty(): source = {} expected = {} actual = invert_dictionary(source) assert actual == expected
def test_given_a_dictionary_invert_dictionary_returns_inverse_dictionary(): source = {0x80: "FOR", 0x81: "GO"} expected = {"FOR": 0x80, "GO": 0x81} actual = invert_dictionary(source) assert actual == expected