示例#1
0
 def test_fields_and_note(self):
     val = "project name {\nfield1: 'value1'\nfield2: 'value2'\nnote: 'note value'}"
     res = project.parseString(val, parseAll=True)
     self.assertEqual(res[0].name, 'name')
     self.assertEqual(res[0].items['field1'], 'value1')
     self.assertEqual(res[0].items['field2'], 'value2')
     self.assertEqual(res[0].note.text, 'note value')
示例#2
0
 def test_comment(self):
     val = "//comment before\nproject name {\nfield1: 'value1'\nfield2: 'value2'\nnote: 'note value'}"
     res = project.parseString(val, parseAll=True)
     self.assertEqual(res[0].name, 'name')
     self.assertEqual(res[0].items['field1'], 'value1')
     self.assertEqual(res[0].items['field2'], 'value2')
     self.assertEqual(res[0].note.text, 'note value')
     self.assertEqual(res[0].comment, 'comment before')
示例#3
0
 def test_fields(self):
     val = "project name {field1: 'value1' field2: 'value2'}"
     res = project.parseString(val, parseAll=True)
     self.assertEqual(res[0].name, 'name')
     self.assertEqual(res[0].items['field1'], 'value1')
     self.assertEqual(res[0].items['field2'], 'value2')
示例#4
0
 def test_empty(self):
     val = 'project name {}'
     res = project.parseString(val, parseAll=True)
     self.assertEqual(res[0].name, 'name')