Spaces:
Sleeping
Sleeping
WilliamBChf
commited on
Commit
•
82f5f4d
1
Parent(s):
5509b10
Added some comments to explain tests
Browse files- pysr/test/cliTest.py +7 -1
pysr/test/cliTest.py
CHANGED
@@ -3,10 +3,16 @@ import unittest
|
|
3 |
|
4 |
|
5 |
def run_command(command):
|
|
|
|
|
|
|
6 |
return subprocess.run(command.split(" "), stdout=subprocess.PIPE).stdout.decode("utf-8").replace("\r\n", "\n")
|
7 |
|
8 |
|
9 |
def make_command(command):
|
|
|
|
|
|
|
10 |
return "\n".join(command)
|
11 |
|
12 |
|
@@ -25,7 +31,7 @@ class TestCli(unittest.TestCase):
|
|
25 |
|
26 |
expected = make_command(expected_lines)
|
27 |
actual = run_command(command_to_test)
|
28 |
-
self.assertEqual(expected, actual)
|
29 |
|
30 |
def test_help_on_install(self):
|
31 |
command_to_test = "python -m pysr install --help"
|
|
|
3 |
|
4 |
|
5 |
def run_command(command):
|
6 |
+
"""
|
7 |
+
Retrieve output of a command string, decode and convert from CRLF to LF formatting
|
8 |
+
"""
|
9 |
return subprocess.run(command.split(" "), stdout=subprocess.PIPE).stdout.decode("utf-8").replace("\r\n", "\n")
|
10 |
|
11 |
|
12 |
def make_command(command):
|
13 |
+
"""
|
14 |
+
Convert string into list with LF formatting (for unix systems), using \n delimiter
|
15 |
+
"""
|
16 |
return "\n".join(command)
|
17 |
|
18 |
|
|
|
31 |
|
32 |
expected = make_command(expected_lines)
|
33 |
actual = run_command(command_to_test)
|
34 |
+
self.assertEqual(expected, actual)
|
35 |
|
36 |
def test_help_on_install(self):
|
37 |
command_to_test = "python -m pysr install --help"
|