Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for test_encode_custom_json_encoders_model_pydanticv2 (0.21 sec)

  1. tests/test_jsonable_encoder.py

    
    def test_encode_unsupported():
        unserializable = Unserializable()
        with pytest.raises(ValueError):
            jsonable_encoder(unserializable)
    
    
    @needs_pydanticv2
    def test_encode_custom_json_encoders_model_pydanticv2():
        from pydantic import field_serializer
    
        class ModelWithCustomEncoder(BaseModel):
            dt_field: datetime
    
            @field_serializer("dt_field")
    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