def test_quoted_string_part(self): parser = DsnParser() got = parser.parse(''' (pcb test.dsn (parser (string_quote ") (space_in_quoted_tokens on) (host_cad "Kicad's PCBNEW") (host_version "(2011-06-28)") ) (pins A1-"-") )''') correct = [ 'pcb', 'test.dsn', [ 'parser', ['string_quote', '"'], ['space_in_quoted_tokens', 'on'], ['host_cad', "Kicad's PCBNEW"], ['host_version', '(2011-06-28)'] ], ['pins', 'A1--'], ] self.assertEqual(correct, got)
def test_plain_parser(self): parser = DsnParser() got = parser.parse(''' (pcb test.dsn (parser (host_cad "Kicad's PCBNEW") (host_version "(2011-06-28)") ) )''') correct = ['pcb', 'test.dsn', ['parser', ['host_cad', "\"Kicad's", "PCBNEW\""], ['host_version', '"', ['2011-06-28'], '"'] ] ] self.assertEqual(correct, got)
def test_quote_parser(self): parser = DsnParser() got = parser.parse(''' (pcb test.dsn (parser (string_quote ") (host_cad "Kicad's PCBNEW) (host_version "(2011-06-28)") ) )''') correct = ['pcb', 'test.dsn', ['parser', ['string_quote', '"'], ['host_cad', "Kicad's", "PCBNEW"], ['host_version', '(2011-06-28)'] ] ] self.assertEqual(correct, got)
def test_quoted_string_part(self): parser = DsnParser() got = parser.parse(''' (pcb test.dsn (parser (string_quote ") (space_in_quoted_tokens on) (host_cad "Kicad's PCBNEW") (host_version "(2011-06-28)") ) (pins A1-"-") )''') correct = ['pcb', 'test.dsn', ['parser', ['string_quote', '"'], ['space_in_quoted_tokens', 'on'], ['host_cad', "Kicad's PCBNEW"], ['host_version', '(2011-06-28)'] ], ['pins', 'A1--'], ] self.assertEqual(correct, got)