Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for test_encode_custom_json_encoders_model_pydanticv2 (0.28 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")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 9K bytes
    - Viewed (0)
Back to top