mirror of
https://github.com/Ahp06/SUMO_Emissions.git
synced 2024-11-21 11:16:28 +00:00
Update tests
This commit is contained in:
parent
d5d6463c72
commit
426bd572dc
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user