Exemple #1
0
 def test_obj2dict_object_classkey(self):
     class A(object):
         pass
     obj = A()
     obj.foo = 'bar'
     assert dutils.obj2dict(obj, classkey='kls') == {
         'foo': 'bar', 'kls': 'A'}
Exemple #2
0
 def test_obj2dict_object_classkey(self):
     class A(object):
         pass
     obj = A()
     obj.foo = 'bar'
     assert dutils.obj2dict(obj, classkey='kls') == {
         'foo': 'bar', 'kls': 'A'}
Exemple #3
0
 def test_obj2dict_list(self):
     assert dutils.obj2dict([{'foo': 'bar'}]) == [{'foo': 'bar'}]
Exemple #4
0
 def test_obj2dict_dict(self):
     assert dutils.obj2dict({'foo': 'bar'}) == {'foo': 'bar'}
Exemple #5
0
 def test_obj2dict_simple_types(self):
     assert dutils.obj2dict(1) == 1
     assert dutils.obj2dict('foo') == 'foo'
     assert dutils.obj2dict(None) is None
Exemple #6
0
 def test_obj2dict_object(self):
     class A(object):
         pass
     obj = A()
     obj.foo = 'bar'
     assert dutils.obj2dict(obj) == {'foo': 'bar'}
Exemple #7
0
 def test_obj2dict_list(self):
     assert dutils.obj2dict([{'foo': 'bar'}]) == [{'foo': 'bar'}]
Exemple #8
0
 def test_obj2dict_dict(self):
     assert dutils.obj2dict({'foo': 'bar'}) == {'foo': 'bar'}
Exemple #9
0
 def test_obj2dict_simple_types(self):
     assert dutils.obj2dict(1) == 1
     assert dutils.obj2dict('foo') == 'foo'
     assert dutils.obj2dict(None) is None
Exemple #10
0
 def test_obj2dict_object(self):
     class A(object):
         pass
     obj = A()
     obj.foo = 'bar'
     assert dutils.obj2dict(obj) == {'foo': 'bar'}