Beispiel #1
0
 def test_it_parses_arithmetic_expressions_as_columns_with_alias(self):
     assert parse_sql('select 1+2 as three,that from hornswoggler;')
Beispiel #2
0
 def test_it_parses_quoted_sql_strings_as_columns(self):
     assert parse_sql("select 'hello',that from hornswoggler;")
Beispiel #3
0
 def test_select_column_names_without_spaces_parses(self):
     assert parse_sql('select this,that from hornswoggler;')
Beispiel #4
0
 def test_it_parses_arithmetic_expressions_as_columns(self):
     assert parse_sql('select (1+2), that from hornswoggler;')
Beispiel #5
0
 def test_space_before_semicolon_parses(self):
     assert parse_sql("select * from hornswoggler ;")
Beispiel #6
0
 def test_select_float_literal_parses(self):
     assert parse_sql('select 1.5, that from hornswoggler;')
Beispiel #7
0
 def test_it_parses_select_distinct(self):
     assert parse_sql('select distinct this, that from hornswoggler;')
Beispiel #8
0
 def test_it_parses_case_expressions_as_columns(self):
     assert parse_sql(
         'select case when x then y end as boop,that from hornswoggler;')
Beispiel #9
0
 def test_missing_table_name_starting_with_underscore_raises_exception(
         self):
     with pytest.raises(ParseException):
         parse_sql("select * from _hornswoggler ;")
Beispiel #10
0
 def test_missing_table_name_raises_parse_exception(self):
     with pytest.raises(ParseException):
         parse_sql("select * from  ;")
Beispiel #11
0
 def test_missing_column_name_starting_with_float_raises_exception(self):
     with pytest.raises(ParseException):
         parse_sql("select 1.7y from hornswoggler ;")
Beispiel #12
0
 def test_missing_column_name_list_raises_parse_exception(self):
     with pytest.raises(ParseException):
         parse_sql("select from hornswoggler ;")
Beispiel #13
0
 def test_two_selects_parses(self):
     assert parse_sql(
         "select * from hornswoggler; select * from hornswoggler ;")
Beispiel #14
0
 def test_it_parses_comparison_expressions_as_columns(self):
     assert parse_sql('select 1 > 2 as boop,that from hornswoggler;')
Beispiel #15
0
 def test_it_parses_select_all(self):
     assert parse_sql('select all this, that from hornswoggler;')
Beispiel #16
0
 def test_it_parses_boolean_expressions_as_columns(self):
     assert parse_sql(
         'select 1 > 2 AND not x as boop,that from hornswoggler;')
Beispiel #17
0
 def test_select_number_literal_parses(self):
     assert parse_sql('select 1, that from hornswoggler;')
Beispiel #18
0
 def test_it_does_not_require_a_from_clause(self):
     assert parse_sql('select 1;')
Beispiel #19
0
 def test_select_star_parses(self):
     assert parse_sql('select * from hornswoggler;')