def test_match_whitespace_diff(self): source_str = "SELECT * FROM `universe.galaxy.system`" target_str = "SELECT * FROM `universe.galaxy.system` " source = Source(source_str) target = Source(target_str) encoded_source = EncodedSource(DecomposedSource(ParsedSource(source))) encoded_target = EncodedSource(DecomposedSource(ParsedSource(target))) self.assertIsNotNone(encoded_source) self.assertIsNotNone(encoded_target) self.assertNotEqual(source_str, target_str) self.assertNotEqual(source.source(), target.source()) self.assertEqual(encoded_source.encoded_sources(), encoded_target.encoded_sources())
def test_cte_complex_parse(self): source_str = complex_query source = Source(source_str) self.assertIsNotNone(source) parsed_source = ParsedSource(source) self.assertIsNotNone(parsed_source) self.assertEqual(source_str, source.source()) self.assertNotEqual(source_str, parsed_source.parsed_statements())
def test_cte_basic_parse(self): source = Source(basic_str) self.assertIsNotNone(source) parsed_source = ParsedSource(source) self.assertIsNotNone(parsed_source) self.assertEqual(basic_str, source.source()) self.assertNotEqual(basic_str, parsed_source.parsed_statements())
def test_cte_parse_matches(self): source_str = basic_str source = Source(source_str) parsed_source = ParsedSource(source) source_2 = Source(basic_whitespace_str) self.assertIsNotNone(source_2) parsed_source_2 = ParsedSource(source_2) self.assertIsNotNone(parsed_source_2) self.assertEqual(basic_whitespace_str, source_2.source()) self.assertNotEqual(basic_whitespace_str, parsed_source_2.parsed_statements()) self.assertEqual(parsed_source.serialize(), parsed_source_2.serialize())
def test_source(self): source_str = cte_1 source = Source(source_str) self.assertIsNotNone(source) self.assertEqual(source_str, source.source())