def test_sequence_in_sequence_in_sequence(self): # This is not a legal event type since sequences need to all be the same type, however it still parses... expected_result = [ 1, 2, 3, ['a', 'b', 'c'], [['aa', 'bb'], ['cc', 'dd']] ] tokens = _tokenize('[1,2,3,["a","b","c"],[["aa","bb"],["cc","dd"]]]') parsed_package = _sequence.parse(tokens) self.assertEqual(parsed_package, expected_result)
def test_empty_sequence_in_sequence_in_sequence(self): expected_result = [[[]]] tokens = _tokenize('[[[]]]') parsed_package = _sequence.parse(tokens) self.assertEqual(parsed_package, expected_result)
def test_sequence_in_sequence(self): expected_result = [[1, 2, 3], [4, 5, 6], [7, 8], [9]] tokens = _tokenize('[[1,2,3],[4,5,6],[7,8],[9]]') parsed_package = _sequence.parse(tokens) self.assertEqual(parsed_package, expected_result)
def test_one_item_sequence(self): expected_result = ['Thor'] tokens = _tokenize('["Thor"]') parsed_package = _sequence.parse(tokens) self.assertEqual(parsed_package, expected_result)
def test_sequence_numbers(self): expected_result = [1, 2, 3, 4] tokens = _tokenize('[1,2,3,4]') parsed_package = _sequence.parse(tokens) self.assertEqual(parsed_package, expected_result)
def test_sequence_string(self): expected_result = ['a', 'b', 'c'] tokens = _tokenize('["a","b","c"]') parsed_package = _sequence.parse(tokens) self.assertEqual(parsed_package, expected_result)