-
Notifications
You must be signed in to change notification settings - Fork 379
Expand file tree
/
Copy pathtest_parse.py
More file actions
29 lines (24 loc) · 1.07 KB
/
test_parse.py
File metadata and controls
29 lines (24 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from sql.parse import parse
from six.moves import configparser
try:
from traitlets.config.configurable import Configurable
except ImportError:
from IPython.config.configurable import Configurable
empty_config = Configurable()
def test_parse_no_sql():
assert parse("will:longliveliz@localhost/shakes", empty_config) == \
{'connection': "will:longliveliz@localhost/shakes",
'sql': ''}
def test_parse_with_sql():
assert parse("postgresql://will:longliveliz@localhost/shakes SELECT * FROM work",
empty_config) == \
{'connection': "postgresql://will:longliveliz@localhost/shakes",
'sql': 'SELECT * FROM work'}
def test_parse_sql_only():
assert parse("SELECT * FROM work", empty_config) == \
{'connection': "",
'sql': 'SELECT * FROM work'}
def test_parse_postgresql_socket_connection():
assert parse("postgresql:///shakes SELECT * FROM work", empty_config) == \
{'connection': "postgresql:///shakes",
'sql': 'SELECT * FROM work'}