1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00

rename tests and add conversion function tests

This commit is contained in:
Kelly Brazil
2022-01-19 10:31:36 -08:00
parent 623d148712
commit 06a322cf9c

View File

@ -4,7 +4,7 @@ import jc.lib
class MyTests(unittest.TestCase):
def test_jc_lib_parse_csv(self):
def test_lib_parse_csv(self):
data = {
'': [],
'a,b,c\n1,2,3': [{'a':'1', 'b':'2', 'c':'3'}]
@ -13,10 +13,10 @@ class MyTests(unittest.TestCase):
for test_data, expected_output in data.items():
self.assertEqual(jc.lib.parse('csv', test_data), expected_output)
def test_jc_lib_parse_csv_s_is_generator(self):
def test_lib_parse_csv_s_is_generator(self):
self.assertIsInstance(jc.lib.parse('csv_s', 'a,b,c\n1,2,3'), Generator)
def test_jc_lib_parse_kv(self):
def test_lib_parse_kv(self):
data = {
'': {},
'a=1\nb=2\nc=3': {'a':'1', 'b':'2', 'c':'3'}
@ -25,20 +25,26 @@ class MyTests(unittest.TestCase):
for test_data, expected_output in data.items():
self.assertEqual(jc.lib.parse('kv', test_data), expected_output)
def test_jc_lib_parser_mod_list_is_list(self):
def test_lib_parser_mod_list_is_list(self):
self.assertIsInstance(jc.lib.parser_mod_list(), list)
def test_jc_lib_parser_mod_list_contains_csv(self):
def test_lib_parser_mod_list_contains_csv(self):
self.assertTrue('csv' in jc.lib.parser_mod_list())
def test_jc_lib_parser_mod_list_length(self):
def test_lib_parser_mod_list_length(self):
self.assertGreaterEqual(len(jc.lib.parser_mod_list()), 80)
def test_jc_lib_plugin_parser_mod_list_is_list(self):
def test_lib_plugin_parser_mod_list_is_list(self):
self.assertIsInstance(jc.lib.plugin_parser_mod_list(), list)
def test_jc_lib_plugin_parser_mod_list_length_is_zero(self):
def test_lib_plugin_parser_mod_list_length_is_zero(self):
self.assertEqual(len(jc.lib.plugin_parser_mod_list()), 0)
def test_lib_cliname_to_modname(self):
self.assertEqual(jc.lib._cliname_to_modname('module-name'), 'module_name')
def test_lib_modname_to_cliname(self):
self.assertEqual(jc.lib._modname_to_cliname('module_name'), 'module-name')
if __name__ == '__main__':
unittest.main()