Skip to content

Commit

Permalink
Test parsing composed elements w/ simple elements
Browse files Browse the repository at this point in the history
  • Loading branch information
0x64746b committed May 5, 2014
1 parent 1384083 commit 06792c0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,25 @@ def test_can_parse_composed_elements_containing_datetimes(self):
# check result
self.assertEqual(parsed_element.testElement.testDate, test_date_1)
self.assertEqual(parsed_element.testElement.anotherDate, test_date_2)

def test_can_parse_composed_elements_containing_simple_elements(self):
# setup test data
test_value_1 = 'test_string_1'
test_value_2 = 'test_string_2'

test_element = """
testElement {
char aValue="%(first_value)s"
char anotherValue="%(second_value)s"
} #testElement
""" % {
'first_value': test_value_1,
'second_value': test_value_2,
}

# test parsing of simple values in composed elements
parsed_element = parser.COMPOSED_ELEMENT.parseString(test_element)

# check result
self.assertEqual(parsed_element.testElement.aValue, test_value_1)
self.assertEqual(parsed_element.testElement.anotherValue, test_value_2)

0 comments on commit 06792c0

Please sign in to comment.