Example #1
0
 def test_cast_operator_suggests_schema_qualified_types():
     texts = [
         'SELECT foo::bar.',
         'SELECT foo::bar.baz',
         'SELECT (x + y)::bar.',
     ]
     for text in texts:
         assert set(suggest_type(text, text)) == set(
             [Datatype(schema='bar'),
              Table(schema='bar')])
Example #2
0
 def test_cast_operator_suggests_types():
     texts = [
         'SELECT x::',
         'SELECT x::y',
         'SELECT (x + y)::',
     ]
     for text in texts:
         assert set(suggest_type(text, text)) == set(
             [Datatype(schema=None),
              Table(schema=None),
              Schema()])
Example #3
0
    def test_identifier_suggests_types_in_parentheses():
        texts = [
            'CREATE TABLE foo (bar ',
            'CREATE TABLE foo (bar DOU',
            'CREATE TABLE foo (bar INT, baz ',
            'CREATE TABLE foo (bar INT, baz TEXT, qux ',
            'CREATE FUNCTION foo (bar ',
            'CREATE FUNCTION foo (bar INT, baz ',
            'SELECT * FROM foo() AS bar (baz ',
            'SELECT * FROM foo() AS bar (baz INT, qux ',

            # make sure this doesnt trigger special completion
            'CREATE TABLE foo (dt d',
        ]
        for text in texts:
            assert set(suggest_type(text, text)) == set(
                [Datatype(schema=None),
                 Table(schema=None),
                 Schema()])
Example #4
0
 def test_alter_column_type_suggests_types():
     q = 'ALTER TABLE foo ALTER COLUMN bar TYPE '
     assert set(suggest_type(q, q)) == set(
         [Datatype(schema=None),
          Table(schema=None),
          Schema()])
def test_identifier_suggests_types_in_parentheses(text):
    assert set(suggest_type(text, text)) == set(
        [Datatype(schema=None),
         Table(schema=None),
         Schema()])
def test_cast_operator_suggests_schema_qualified_types(text):
    assert set(suggest_type(text, text)) == set(
        [Datatype(schema='bar'), Table(schema='bar')])
def test_cast_operator_suggests_types(text):
    assert set(suggest_type(text, text)) == set(
        [Datatype(schema=None),
         Table(schema=None),
         Schema()])