1
0
mirror of https://github.com/Ahp06/SUMO_Emissions.git synced 2024-11-21 19:16:30 +00:00

Update tests

This commit is contained in:
Thibaud Gasser 2019-02-01 18:00:55 +01:00
parent d5d6463c72
commit 426bd572dc

View File

@ -1,3 +1,4 @@
import io
import os
import shutil
import tempfile
@ -110,5 +111,33 @@ class GenerationTests(unittest.TestCase):
self.assertTrue(os.path.isdir(path), msg=f'{path} is not a directory')
class InputTests(unittest.TestCase):
def test_commandline(self):
options = ['--name', 'test-config', '--path', '/some/path', '--vclass', 'passenger=10', 'truck=1', '--', 'test.osm']
actual_conf = configurator.parse_command_line(options)
self.assertEqual(actual_conf.name, 'test-config')
self.assertEqual(actual_conf.osmfile, 'test.osm')
self.assertEqual(actual_conf.path, '/some/path')
self.assertEqual(actual_conf.vclasses, {'passenger': '10', 'truck': '1'})
def test_from_config_file(self):
options = """
{
"name": "test-config",
"path": "/some/path",
"vclasses": {
"passenger": 10,
"truck": 1
},
"osmfile": "test.osm"
}
"""
actual_conf = configurator.parse_json(io.StringIO(options))
self.assertEqual(actual_conf.name, 'test-config')
self.assertEqual(actual_conf.osmfile, 'test.osm')
self.assertEqual(actual_conf.path, '/some/path')
self.assertEqual(actual_conf.vclasses, {'passenger': 10, 'truck': 1})
if __name__ == '__main__':
unittest.main()