Fixed type_util.is_json_serializable with set objects.
This commit is contained in:
parent
7a4920705d
commit
de6d6b13a8
|
@ -46,7 +46,7 @@ def is_integer(val):
|
|||
|
||||
|
||||
def is_json_serializable(val):
|
||||
json_types = (type(None), bool, dict, float, list, tuple, set, ) + \
|
||||
json_types = (type(None), bool, dict, float, list, tuple, ) + \
|
||||
integer_types + string_types
|
||||
return isinstance(val, json_types)
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ class type_util_test_case(unittest.TestCase):
|
|||
self.assertFalse(f(datetime.now()))
|
||||
self.assertTrue(f((0, 1, 2, )))
|
||||
self.assertTrue(f([0, 1, 2]))
|
||||
self.assertTrue(f(set([0, 1, 2])))
|
||||
self.assertFalse(f(set([0, 1, 2])))
|
||||
self.assertTrue(f({'a':0, 'b':1, 'c':2}))
|
||||
self.assertTrue(f('hello world'))
|
||||
self.assertFalse(f(lambda a: a))
|
||||
|
|
Loading…
Reference in New Issue