Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for arbitrary_types_allowed (0.17 sec)

  1. tests/test_jsonable_encoder.py

    def test_encode_model_with_pure_path():
        class ModelWithPath(BaseModel):
            path: PurePath
    
            if PYDANTIC_V2:
                model_config = {"arbitrary_types_allowed": True}
            else:
    
                class Config:
                    arbitrary_types_allowed = True
    
        test_path = PurePath("/foo", "bar")
        obj = ModelWithPath(path=test_path)
        assert jsonable_encoder(obj) == {"path": str(test_path)}
    
    
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Thu Apr 18 21:56:59 UTC 2024
    - 9K bytes
    - Viewed (0)
  2. tests/test_inherited_custom_class.py

            with pytest.raises(TypeError):
                vars(asyncpg_uuid)
            return {"fast_uuid": asyncpg_uuid}
    
        class SomeCustomClass(BaseModel):
            model_config = {"arbitrary_types_allowed": True}
    
            a_uuid: MyUuid
    
            @field_serializer("a_uuid")
            def serialize_a_uuid(self, v):
                return str(v)
    
        @app.get("/get_custom_class")
        def return_some_user():
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 3K bytes
    - Viewed (0)
Back to top