def test_dT_suggests_schema_or_datatypes(): text = '\\dT ' suggestions = suggest_type(text, text) assert set(suggestions) == set([ Schema(), Datatype(schema=None), ])
def test_alter_column_type_suggests_types(): q = "ALTER TABLE foo ALTER COLUMN bar TYPE " assert set(suggest_type(q, q)) == { 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()])
def test_schema_qualified_dT_suggests_datatypes(): text = "\\dT foo." suggestions = suggest_type(text, text) assert suggestions == (Datatype(schema="foo"),)
def test_schema_qualified_dT_suggests_datatypes(): text = '\\dT foo.' suggestions = suggest_type(text, text) assert suggestions == (Datatype(schema='foo'), )
def test_dT_suggests_schema_or_datatypes(): text = "\\dT " suggestions = suggest_type(text, text) assert set(suggestions) == {Schema(), Datatype(schema=None)}
def test_cast_operator_suggests_schema_qualified_types(text): assert set(suggest_type(text, text)) == { Datatype(schema="bar"), Table(schema="bar"), }