@@ -28,29 +28,23 @@ def test_cli_help(capsys):
2828 captured_output = capsys .readouterr ().out
2929
3030 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 \
5145 A list of virtual module mappings in `db:schema ...`\n \
52- format"
53- in captured_output
46+ format\n "
47+ == captured_output
5448 )
5549
5650
@@ -68,7 +62,13 @@ def test_cli_config():
6862
6963 stdout , stderr = process .communicate ()
7064
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+ )
7272
7373
7474def test_cli_args ():
@@ -86,9 +86,9 @@ def test_cli_args():
8686 process .stdin .flush ()
8787
8888 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 ]
9292
9393
9494def test_cli_schemas ():
@@ -118,7 +118,10 @@ def test_cli_schemas():
118118 {"key" : 8 , "value" : 16 },
119119 {"key" : 9 , "value" : 18 },
120120 ]
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+ )
122125 assert "'test_schema1'" == stdout [4 :18 ]
123126 assert "Schema `djtest_test1`" == stdout [23 :44 ]
124127 assert fetch_res == json .loads (stdout [50 :295 ].replace ("'" , '"' ))
0 commit comments