コード例 #1
0
def _read_tokens(filename, start, end):
    with open(filename, 'r') as file:
        content = file.readlines()
    lines = content[start:end]
    tokens = []
    for line in lines:
        tokens.append(Token.load_xml(line.strip()))
    return tokens
コード例 #2
0
 def test_load_xml(self):
     string = '<integerConstant>30</integerConstant>'
     token = Token.load_xml(string)
     self.assertEqual(token.to_xml(), string)