Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for __str__ (0.04 sec)

  1. tests/test_inherited_custom_class.py

    import pytest
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    
    class MyUuid:
        def __init__(self, uuid_string: str):
            self.uuid = uuid_string
    
        def __str__(self):
            return self.uuid
    
        @property  # type: ignore
        def __class__(self):
            return uuid.UUID
    
        @property
        def __dict__(self):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 1.8K bytes
    - Viewed (0)
  2. fastapi/exceptions.py

            if self.endpoint_path:
                context += f"\n    {self.endpoint_path}"
            return context
    
        def __str__(self) -> str:
            message = f"{len(self._errors)} validation error{'s' if len(self._errors) != 1 else ''}:\n"
            for err in self._errors:
                message += f"  {err}\n"
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 6.8K bytes
    - Viewed (0)
  3. tests/test_jsonable_encoder.py

    @dataclass
    class Item:
        name: str
        count: int
    
    
    class DictablePerson(Person):
        def __iter__(self):
            return ((k, v) for k, v in self.__dict__.items())
    
    
    class DictablePet(Pet):
        def __iter__(self):
            return ((k, v) for k, v in self.__dict__.items())
    
    
    class Unserializable:
        def __iter__(self):
            raise NotImplementedError()
    
        @property
        def __dict__(self):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 9.2K bytes
    - Viewed (0)
  4. tests/test_dependency_after_yield_websockets.py

    from fastapi import Depends, FastAPI, WebSocket
    from fastapi.testclient import TestClient
    
    
    class Session:
        def __init__(self) -> None:
            self.data = ["foo", "bar", "baz"]
            self.open = True
    
        def __iter__(self) -> Generator[str, None, None]:
            for item in self.data:
                if self.open:
                    yield item
                else:
                    raise ValueError("Session closed")
    
    
    @contextmanager
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 2K bytes
    - Viewed (0)
  5. tests/test_dependency_after_yield_streaming.py

    from fastapi.responses import StreamingResponse
    from fastapi.testclient import TestClient
    
    
    class Session:
        def __init__(self) -> None:
            self.data = ["foo", "bar", "baz"]
            self.open = True
    
        def __iter__(self) -> Generator[str, None, None]:
            for item in self.data:
                if self.open:
                    yield item
                else:
                    raise ValueError("Session closed")
    
    
    @contextmanager
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 3.2K bytes
    - Viewed (0)
Back to top