Commit cebd7e35 authored by Naoki Kambe's avatar Naoki Kambe
Browse files

[trac930] modify parse_spec function returns empty dict if list-type

is not specified in the argument
parent 8750dc3a
......@@ -72,6 +72,7 @@ def parse_spec(spec):
"""
parse spec type data
"""
if type(spec) is not list: return {}
def _parse_spec(spec):
item_type = spec['item_type']
if item_type == "integer":
......
......@@ -69,7 +69,7 @@ class TestUtilties(unittest.TestCase):
'test_list2' : [0,0,0],
'test_map2' : { 'A' : 0, 'B' : 0, 'C' : 0 },
'test_none' : None })
self.assertRaises(TypeError, stats.parse_spec, None)
self.assertEqual(stats.parse_spec(None), {})
self.assertRaises(KeyError, stats.parse_spec, [{'item_name':'Foo'}])
def test_get_timestamp(self):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment