Exemplo n.º 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')
Exemplo n.º 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')
Exemplo n.º 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')
Exemplo n.º 4
0
 def test_empty(self):
     val = 'project name {}'
     res = project.parseString(val, parseAll=True)
     self.assertEqual(res[0].name, 'name')