From 8abc93987e062986c1d1a59eef55e3ec939984d3 Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Tue, 1 Dec 2026 15:27:53 +0100 Subject: [PATCH] Generate the fake coordinates as `float`s Also, remove the misleading comment in `Location` --- src/velofy/db/utils/locations.py | 1 - tests/db/fake_data/factories/addresses.py | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/velofy/db/utils/locations.py b/src/velofy/db/utils/locations.py index 8b95cba..2859f94 100644 --- a/src/velofy/db/utils/locations.py +++ b/src/velofy/db/utils/locations.py @@ -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) diff --git a/tests/db/fake_data/factories/addresses.py b/tests/db/fake_data/factories/addresses.py index b519e46..fb52c42 100644 --- a/tests/db/fake_data/factories/addresses.py +++ b/tests/db/fake_data/factories/addresses.py @@ -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))