def test_regeneration(self): for name, val in globals().items(): if name.startswith('input_data_'): result = chunkparser.generate(chunkparser.parse(val)) #print 'EXPECTED:' #print val #print 'ACTUAL:' #print result self.assertEqual(val, result)
def _load_chunks(preflags): filename = _get_cmakelists(preflags) f = open(filename, 'r') data = f.read() f.close() return chunkparser.parse(data)
def test_multi_line_input_with_final_newline(self): result = chunkparser.parse(input_data_testtesttest_nl) self.assertEqual(['test', 'test', 'test', ''], result)
def test_single_line_input_no_final_newline(self): result = chunkparser.parse(input_data_test) self.assertEqual(['test'], result)
def test_empty_input(self): result = chunkparser.parse(input_data_emptystring) self.assertEqual([''], result)
def test_bad(self): for name, val in globals().items(): if name.startswith('input_baddata_'): self.assertRaises(Exception, lambda: chunkparser.parse(val))
def test_nested_chunks(self): result = chunkparser.parse(input_data_proj6) self.assertEqual(['a', ['b', ['c', ['d', ['e']]]], 'f', ''], result)
def test_sequence_of_chunks(self): result = chunkparser.parse(input_data_proj5) self.assertEqual(['a', ['b', ['c']], 'd', ['e', ['f']], 'g', ''], result)
def test_everything_in_one_chunk_trailing_blank_lines(self): result = chunkparser.parse(input_data_proj4) self.assertEqual([['test', ['test', 'test']], '', '', ''], result)
def test_everything_in_one_chunk_with_final_newline(self): result = chunkparser.parse(input_data_proj2) self.assertEqual([['test', ['test', 'test']], ''], result)