lalib/tests/elements/test_top_level_imports.py
Alexander Hess 3cfc0db136
Organize top-level imports for lalib.elements
- make `GF2`, `one`, and `zero`, defined in the `lalib.elements.gf2`
  module, available as top-level imports in the `lalib.elements`
  sub-package via `from lalib.elements import *`
- provide some code snippets in the sub-package's docstring
- test the star import
2024-09-18 18:29:40 +02:00

18 lines
528 B
Python

"""Test top-level imports for `lalib.elements`."""
from lalib import elements as top_level
def test_top_level_imports():
"""Verify `from lalib.elements import *` works."""
environment = {}
exec("...", environment, environment) # noqa: S102
defined_vars_before = set(environment)
exec("from lalib.elements import *", environment, environment) # noqa: S102
defined_vars_after = set(environment)
new_vars = defined_vars_after - defined_vars_before
assert new_vars == set(top_level.__all__)