@@ -28,29 +28,23 @@ def test_cli_help(capsys):
28
28
captured_output = capsys .readouterr ().out
29
29
30
30
assert (
31
- "usage: datajoint [--help] [-V] [-u USER] [-p PASSWORD] [-h HOST]\n \
32
- [-s SCHEMAS [SCHEMAS ...]]"
33
- in captured_output
34
- )
35
- assert "DataJoint console interface." in captured_output
36
- assert "optional arguments:" in captured_output
37
- assert "--help show this help message and exit" in captured_output
38
- assert (
39
- "-V, --version show program's version number and exit"
40
- in captured_output
41
- )
42
- assert "-u USER, --user USER Datajoint username" in captured_output
43
- assert (
44
- "-p PASSWORD, --password PASSWORD\n \
45
- Datajoint password"
46
- in captured_output
47
- )
48
- assert "-h HOST, --host HOST Datajoint host" in captured_output
49
- assert (
50
- "-s SCHEMAS [SCHEMAS ...], --schemas SCHEMAS [SCHEMAS ...]\n \
31
+ "\
32
+ usage: datajoint [--help] [-V] [-u USER] [-p PASSWORD] [-h HOST]\n \
33
+ [-s SCHEMAS [SCHEMAS ...]]\n \n \
34
+ \
35
+ DataJoint console interface.\n \n \
36
+ \
37
+ optional arguments:\n \
38
+ --help show this help message and exit\n \
39
+ -V, --version show program's version number and exit\n \
40
+ -u USER, --user USER Datajoint username\n \
41
+ -p PASSWORD, --password PASSWORD\n \
42
+ Datajoint password\n \
43
+ -h HOST, --host HOST Datajoint host\n \
44
+ -s SCHEMAS [SCHEMAS ...], --schemas SCHEMAS [SCHEMAS ...]\n \
51
45
A list of virtual module mappings in `db:schema ...`\n \
52
- format"
53
- in captured_output
46
+ format\n "
47
+ == captured_output
54
48
)
55
49
56
50
@@ -68,7 +62,13 @@ def test_cli_config():
68
62
69
63
stdout , stderr = process .communicate ()
70
64
71
- assert f"{ dj .config } " in stdout
65
+ assert dj .config == json .loads (
66
+ stdout [4 :519 ]
67
+ .replace ("'" , '"' )
68
+ .replace ("None" , "null" )
69
+ .replace ("True" , "true" )
70
+ .replace ("False" , "false" )
71
+ )
72
72
73
73
74
74
def test_cli_args ():
@@ -86,9 +86,9 @@ def test_cli_args():
86
86
process .stdin .flush ()
87
87
88
88
stdout , stderr = process .communicate ()
89
- assert "test_user" in stdout
90
- assert "test_pass" in stdout
91
- assert "test_host" in stdout
89
+ assert "test_user" == stdout [ 5 : 14 ]
90
+ assert "test_pass" == stdout [ 21 : 30 ]
91
+ assert "test_host" == stdout [ 37 : 46 ]
92
92
93
93
94
94
def test_cli_schemas ():
@@ -118,7 +118,10 @@ def test_cli_schemas():
118
118
{"key" : 8 , "value" : 16 },
119
119
{"key" : 9 , "value" : 18 },
120
120
]
121
- assert "dj repl\n \n schema modules:\n \n - test_schema1\n - test_schema2" in stderr
121
+ assert (
122
+ "dj repl\n \n schema modules:\n \n - test_schema1\n - test_schema2"
123
+ == stderr [159 :218 ]
124
+ )
122
125
assert "'test_schema1'" == stdout [4 :18 ]
123
126
assert "Schema `djtest_test1`" == stdout [23 :44 ]
124
127
assert fetch_res == json .loads (stdout [50 :295 ].replace ("'" , '"' ))
0 commit comments