def test_encode_object(): date = datetime.datetime(2011, 10, 24) assert encode_object(date) == { 'isdst': -1, 'mday': 24, 'hour': 0, 'min': 0, 'sec': 0, 'mon': 10, 'year': 2011, 'yday': 297, 'wday': 0 }
def test_encode_object_json(): class Test(object): def __json__(self): return {'test': True} assert encode_object(Test()) == {'test': True}
def test_encode_object_invalid(): encode_object(fcntl)