import unittest class TestContextBasedAllocationAttribution(unittest.TestCase): def setUp(self): self.a = Parser("a", 128) self.b = Parser("b", 32) self.top_level_parse = TopLevelParse() self.top_level_parse.enter_h_packrat_parse(self.a.address) #TODO: are we initializing from scratch for evers test? self.top_level_parse.enter_h_do_parse(self.a.address) self.top_level_parse.parse_virtual(self.a.address) self.top_level_parse.enter_perform_lowlevel_parse(self.a.address) #TODO: teardown, invoke the return_from_* functions def test_top_of_stack(self): #self.assertEqual(self.top_level_parse.peek_parser(), cr) pass def test_after_h_do_parse(self): self.top_level_parse.enter_h_do_parse(self.b.address) self.assertIs(self.top_level_parse.peek_parser(), self.b) def test_after_enter_parse_virtual(self): self.top_level_parse.enter_h_do_parse(self.b.address) self.top_level_parse._parse_virtual(self.b.address) self.assertIs(self.top_level_parse.peek_parser(), self.b) def test_after_enter_perform_lowlevel_parse(self): self.top_level_parse.enter_h_do_parse(self.b.address) self.top_level_parse._parse_virtual(self.b.address) self.top_level_parse.enter_perform_lowlevel_parse(self.b.address) self.assertIs(self.top_level_parse.peek_parser(), self.b) # TODO: thes need a different setUp() with two parsers pushed on the stack def test_after_return_from_perform_lowlevel_parse(self): pass def test_after_return_from_parse_virtual(self): pass def test_after_return_from_h_do_parse(self): #self.assertIs(self.top_level_parse.peek_parser(), ws) pass