Exemplo n.º 1
0
    def test_parse_ignore_keyword(self):
        deck_string = """
FIPNUM
  100*1 100*2 /

KEYWORD
  1 2 3 /
        """

        parse_context = ParseContext()
        parser = Parser()
        parse_context.ignore_keyword("KEYWORD")
        deck = parser.parse_string(deck_string, parse_context)
        self.assertEqual(len(deck), 1)
Exemplo n.º 2
0
    def test_raw_string_output(self):
        deck_string = """
UDQ
   DEFINE WUOPR2   WOPR '*' * WOPR '*' /
   DEFINE WUGASRA  3 - WGLIR '*' /
/
        """

        parse_context = ParseContext( )
        parser = Parser()
        parse_context.ignore_keyword("KEYWORD")
        deck = parser.parse_string( deck_string )
        udq = deck[0]
        s = ""
        for rec in udq:
            for item in rec:
                s += item.get_str(0)