A semantic search engine for source code https://bitshift.benkurtovic.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

18 lines
522 B

  1. from __future__ import unicode_literals
  2. import unittest
  3. from bitshift.query import parse_query
  4. class TestQueryParser(unittest.TestCase):
  5. """Unit tests for the query parser in :py:mod:`bitshift.query`."""
  6. def test_parse(self):
  7. """test basic query parsing"""
  8. pq = lambda s: parse_query(s).serialize()
  9. self.assertEqual("Tree(Text(String('test')))", pq("test"))
  10. self.assertEqual("Tree(Text(Regex('test')))", pq("re:test"))
  11. if __name__ == "__main__":
  12. unittest.main(verbosity=2)