def test_dT_suggests_schema_or_datatypes(): text = '\\dT ' suggestions = suggest_type(text, text) assert sorted_dicts(suggestions) == sorted_dicts( [{'type': 'schema'}, {'type': 'datatype', 'schema': []}, ])
def test_schema_qualified_dT_suggests_datatypes(): text = '\\dT foo.' suggestions = suggest_type(text, text) assert sorted_dicts(suggestions) == sorted_dicts([{ 'type': 'datatype', 'schema': 'foo' }])
def test_df_suggests_schema_or_function(): suggestions = suggest_type('\\df xxx', '\\df xxx') assert sorted_dicts(suggestions) == sorted_dicts([ {'type': 'function', 'schema': []}, {'type': 'schema'}]) suggestions = suggest_type('\\df myschema.xxx', '\\df myschema.xxx') assert suggestions == [{'type': 'function', 'schema': 'myschema'}]
def test_d_suggests_tables_and_schemas(): suggestions = suggest_type('\d ', '\d ') assert sorted_dicts(suggestions) == sorted_dicts([ {'type': 'schema'}, {'type': 'table', 'schema': []}]) suggestions = suggest_type('\d xxx', '\d xxx') assert sorted_dicts(suggestions) == sorted_dicts([ {'type': 'schema'}, {'type': 'table', 'schema': []}])
def test_dT_suggests_schema_or_datatypes(): text = '\\dT ' suggestions = suggest_type(text, text) assert sorted_dicts(suggestions) == sorted_dicts([ { 'type': 'schema' }, { 'type': 'datatype', 'schema': [] }, ])
def test_slash_suggests_special(): suggestions = suggest_type('\\', '\\') assert sorted_dicts(suggestions) == sorted_dicts([{'type': 'special'}])
def test_slash_d_suggests_special(): suggestions = suggest_type('\\d', '\\d') assert sorted_dicts(suggestions) == sorted_dicts( [{'type': 'special'}])
def test_schema_qualified_dT_suggests_datatypes(): text = '\\dT foo.' suggestions = suggest_type(text, text) assert sorted_dicts(suggestions) == sorted_dicts( [{'type': 'datatype', 'schema': 'foo'}])