Check the type annotations at runtime with typeguard #15

Merged
alexander merged 8 commits from add-typeguard into develop 2026-12-01 17:54:26 +01:00
2 changed files with 2 additions and 3 deletions
Showing only changes of commit 8abc93987e - Show all commits

Generate the fake coordinates as floats

Also, remove the misleading comment in `Location`
Alexander Hess 2026-12-01 15:27:53 +01:00
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -22,7 +22,6 @@ class Location:
def __init__(self, latitude: float, longitude: float) -> None:
"""Create a location from a WGS84-conforming `latitude`-`longitude` pair."""
# The SQLAlchemy columns come as `Decimal`s due to the `DOUBLE_PRECISION`.
self._latitude = float(latitude)
self._longitude = float(longitude)

View file

@ -32,8 +32,8 @@ class AddressFactory(alchemy.SQLAlchemyModelFactory):
)
# Place the addresses somewhere in downtown Paris.
latitude = factory.Faker("coordinate", center=48.855, radius=0.01)
longitude = factory.Faker("coordinate", center=2.34, radius=0.03)
latitude = factory.Faker("pyfloat", min_value=48.845, max_value=48.865)
longitude = factory.Faker("pyfloat", min_value=2.31, max_value=2.37)
# city -> set by the `make_address` fixture as there is only one `city`
city_name = "Paris"
zip_code = factory.LazyFunction(lambda: random.randint(75001, 75020))