File: test_dunder_all.py

package info (click to toggle)
pydantic 2.12.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,628 kB
  • sloc: python: 75,989; javascript: 181; makefile: 115; sh: 38
file content (17 lines) | stat: -rw-r--r-- 777 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
def test_explicit_reexports() -> None:
    from pydantic import __all__ as root_all
    from pydantic.deprecated.tools import __all__ as tools
    from pydantic.main import __all__ as main
    from pydantic.networks import __all__ as networks
    from pydantic.types import __all__ as types

    for name, export_all in [('main', main), ('networks', networks), ('deprecated.tools', tools), ('types', types)]:
        for export in export_all:
            assert export in root_all, f'{export} is in `pydantic.{name}.__all__` but missing in `pydantic.__all__`'


def test_explicit_reexports_exist() -> None:
    import pydantic

    for name in pydantic.__all__:
        assert hasattr(pydantic, name), f'{name} is in `pydantic.__all__` but `from pydantic import {name}` fails'