refactored arg_parser.py test

This commit is contained in:
Alberto 2023-05-05 18:20:17 +02:00
parent 4e7c9c8999
commit 2b2f534feb
1 changed files with 10 additions and 3 deletions

View File

@ -8,8 +8,15 @@ from src import arg_parser
class TestAnalysis(unittest.TestCase):
@patch('sys.argv', ['my_script.py', '-sp', 'test1', '-t', 'test2'])
@patch('sys.argv', ['my_script.py', '-sp', 'test1', '-p', '41234'])
def test_parse_args(self):
sim, tomls = arg_parser.parse_args()
sim, port = arg_parser.parse_args()
print(sim, port)
self.assertEqual(sim, "test1")
self.assertEqual(tomls, "test2")
self.assertEqual(port, "41234")
@patch('sys.argv', ['my_script.py'])
def test_parse_args_default(self):
sim, port = arg_parser.parse_args()
self.assertEqual(sim, "/simulation_data/")
self.assertEqual(port, None)