def test_convert_unknown(): val = ValidationError('Some Error') with pytest.raises(TypeError) as e: convert(val) assert 'ValidationError can not be converted to JSON.' == str(e.value)
def test_convert_date(): val = date(2017, 1, 12) assert convert(val) == '2017-01-12'
def test_convert_datetime(): val = datetime(2017, 1, 12, 13, 6, 11) assert convert(val) == '2017-01-12T13:06:11'
def test_convert_decimal(): val = Decimal('1.1') assert convert(val) == 1.1