Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for test_custom_encoders (0.2 sec)

  1. tests/test_jsonable_encoder.py

        assert jsonable_encoder(model, exclude={}) == {
            "foo": "foo",
            "bar": "bar",
            "bla": "bla",
        }
    
    
    @needs_pydanticv1
    def test_custom_encoders():
        class safe_datetime(datetime):
            pass
    
        class MyModel(BaseModel):
            dt_field: safe_datetime
    
        instance = MyModel(dt_field=safe_datetime.now())
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Apr 18 21:56:59 UTC 2024
    - 9K bytes
    - Viewed (0)
Back to top