Upgrade black
This commit is contained in:
parent
fad875b332
commit
dbdce83067
12 changed files with 1208 additions and 914 deletions
|
|
@ -1,6 +1,5 @@
|
|||
"""Factory to create `Courier` instances."""
|
||||
|
||||
|
||||
import factory
|
||||
from factory import alchemy
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ class AdHocOrderFactory(alchemy.SQLAlchemyModelFactory):
|
|||
# Timestamps after `cancelled_at` are discarded
|
||||
# by the `post_generation` hook at the end of the `OrderFactory`.
|
||||
cancel_ = factory.Trait( # noqa:WPS120 -> leading underscore does not work
|
||||
cancelled=True, cancelled_at_corrected=False,
|
||||
cancelled=True,
|
||||
cancelled_at_corrected=False,
|
||||
)
|
||||
cancel_before_pickup = factory.Trait(
|
||||
cancel_=True,
|
||||
|
|
|
|||
|
|
@ -137,7 +137,10 @@ def make_replay_order(make_order, simulation):
|
|||
order = make_order()
|
||||
|
||||
return factories.ReplayedOrderFactory.build(
|
||||
simulation=simulation, actual=order, courier=order.courier, **kwargs,
|
||||
simulation=simulation,
|
||||
actual=order,
|
||||
courier=order.courier,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return func
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@ class TestConstraints:
|
|||
)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='fk_replayed_orders_to_replay_simulations',
|
||||
sa_exc.IntegrityError,
|
||||
match='fk_replayed_orders_to_replay_simulations',
|
||||
):
|
||||
db_session.execute(stmt)
|
||||
|
||||
|
|
@ -65,7 +66,10 @@ class TestConstraints:
|
|||
db_session.execute(stmt)
|
||||
|
||||
def test_delete_a_referenced_courier(
|
||||
self, db_session, replayed_order, make_courier,
|
||||
self,
|
||||
db_session,
|
||||
replayed_order,
|
||||
make_courier,
|
||||
):
|
||||
"""Remove a record that is referenced with a FK."""
|
||||
# Need a second courier, one that is
|
||||
|
|
@ -79,7 +83,8 @@ class TestConstraints:
|
|||
stmt = sqla.delete(db.Courier).where(db.Courier.id == replayed_order.courier.id)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='fk_replayed_orders_to_couriers',
|
||||
sa_exc.IntegrityError,
|
||||
match='fk_replayed_orders_to_couriers',
|
||||
):
|
||||
db_session.execute(stmt)
|
||||
|
||||
|
|
@ -92,12 +97,15 @@ class TestConstraints:
|
|||
db_session.add(replayed_order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='either_ad_hoc_or_scheduled_order',
|
||||
sa_exc.IntegrityError,
|
||||
match='either_ad_hoc_or_scheduled_order',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
def test_scheduled_order_without_scheduled_delivery_at(
|
||||
self, db_session, make_replay_order,
|
||||
self,
|
||||
db_session,
|
||||
make_replay_order,
|
||||
):
|
||||
"""Insert an instance with invalid data."""
|
||||
replay_order = make_replay_order(scheduled=True)
|
||||
|
|
@ -109,7 +117,8 @@ class TestConstraints:
|
|||
db_session.add(replay_order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='either_ad_hoc_or_scheduled_order',
|
||||
sa_exc.IntegrityError,
|
||||
match='either_ad_hoc_or_scheduled_order',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -122,7 +131,8 @@ class TestConstraints:
|
|||
db_session.add(replay_order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='ad_hoc_orders_within_business_hours',
|
||||
sa_exc.IntegrityError,
|
||||
match='ad_hoc_orders_within_business_hours',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -135,7 +145,8 @@ class TestConstraints:
|
|||
db_session.add(replay_order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='ad_hoc_orders_within_business_hours',
|
||||
sa_exc.IntegrityError,
|
||||
match='ad_hoc_orders_within_business_hours',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -153,7 +164,8 @@ class TestConstraints:
|
|||
db_session.add(replay_pre_order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='scheduled_orders_within_business_hours',
|
||||
sa_exc.IntegrityError,
|
||||
match='scheduled_orders_within_business_hours',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -171,7 +183,8 @@ class TestConstraints:
|
|||
db_session.add(replay_pre_order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='scheduled_orders_within_business_hours',
|
||||
sa_exc.IntegrityError,
|
||||
match='scheduled_orders_within_business_hours',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -210,17 +223,23 @@ class TestConstraints:
|
|||
db_session.add(replay_pre_order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='scheduled_orders_within_business_hours',
|
||||
sa_exc.IntegrityError,
|
||||
match='scheduled_orders_within_business_hours',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
@pytest.mark.parametrize('minute', [min_ for min_ in range(60) if min_ % 15 != 0])
|
||||
def test_scheduled_order_at_non_quarter_of_an_hour(
|
||||
self, db_session, make_replay_order, minute,
|
||||
self,
|
||||
db_session,
|
||||
make_replay_order,
|
||||
minute,
|
||||
):
|
||||
"""Insert an instance with invalid data."""
|
||||
scheduled_delivery_at = dt.datetime( # `minute` is not 0, 15, 30, or 45
|
||||
*test_config.DATE, test_config.NOON, minute,
|
||||
*test_config.DATE,
|
||||
test_config.NOON,
|
||||
minute,
|
||||
)
|
||||
replay_pre_order = make_replay_order(
|
||||
scheduled=True,
|
||||
|
|
@ -240,11 +259,17 @@ class TestConstraints:
|
|||
|
||||
@pytest.mark.parametrize('second', list(range(1, 60)))
|
||||
def test_scheduled_order_at_non_quarter_of_an_hour_by_seconds(
|
||||
self, db_session, make_replay_order, second,
|
||||
self,
|
||||
db_session,
|
||||
make_replay_order,
|
||||
second,
|
||||
):
|
||||
"""Insert an instance with invalid data."""
|
||||
scheduled_delivery_at = dt.datetime(
|
||||
*test_config.DATE, test_config.NOON, 0, second,
|
||||
*test_config.DATE,
|
||||
test_config.NOON,
|
||||
0,
|
||||
second,
|
||||
)
|
||||
replay_pre_order = make_replay_order(
|
||||
scheduled=True,
|
||||
|
|
@ -289,7 +314,8 @@ class TestConstraints:
|
|||
db_session.add(replay_pre_order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='scheduled_orders_not_within_30_minutes',
|
||||
sa_exc.IntegrityError,
|
||||
match='scheduled_orders_not_within_30_minutes',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -355,10 +381,14 @@ class TestConstraints:
|
|||
db_session.commit()
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'column', ['pickup_at', 'left_pickup_at', 'reached_delivery_at', 'delivery_at'],
|
||||
'column',
|
||||
['pickup_at', 'left_pickup_at', 'reached_delivery_at', 'delivery_at'],
|
||||
)
|
||||
def test_no_simulated_cancellation_after_pickup(
|
||||
self, db_session, replayed_order, column,
|
||||
self,
|
||||
db_session,
|
||||
replayed_order,
|
||||
column,
|
||||
):
|
||||
"""Insert an instance with invalid data."""
|
||||
# Setting `.cancelled_at` to the end of a day
|
||||
|
|
@ -386,27 +416,35 @@ class TestConstraints:
|
|||
|
||||
@pytest.mark.parametrize('duration', [-1, 3601])
|
||||
def test_estimated_prep_duration_out_of_range(
|
||||
self, db_session, replayed_order, duration,
|
||||
self,
|
||||
db_session,
|
||||
replayed_order,
|
||||
duration,
|
||||
):
|
||||
"""Insert an instance with invalid data."""
|
||||
replayed_order.estimated_prep_duration = duration
|
||||
db_session.add(replayed_order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='between_0', # constraint name too long
|
||||
sa_exc.IntegrityError,
|
||||
match='between_0', # constraint name too long
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
@pytest.mark.parametrize('duration', [1, 59, 119, 3599])
|
||||
def test_estimated_prep_duration_not_whole_minute(
|
||||
self, db_session, replayed_order, duration,
|
||||
self,
|
||||
db_session,
|
||||
replayed_order,
|
||||
duration,
|
||||
):
|
||||
"""Insert an instance with invalid data."""
|
||||
replayed_order.estimated_prep_duration = duration
|
||||
db_session.add(replayed_order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='must_be_w', # constraint name too long
|
||||
sa_exc.IntegrityError,
|
||||
match='must_be_w', # constraint name too long
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -417,14 +455,19 @@ class TestConstraints:
|
|||
db_session.add(replayed_order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='between_0_and_100',
|
||||
sa_exc.IntegrityError,
|
||||
match='between_0_and_100',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
@pytest.mark.parametrize('column', ['restaurant_notified_at', 'dispatch_at'])
|
||||
@pytest.mark.parametrize('hour', [0, 10])
|
||||
def test_order_dispatched_in_non_business_hour(
|
||||
self, db_session, replayed_order, column, hour,
|
||||
self,
|
||||
db_session,
|
||||
replayed_order,
|
||||
column,
|
||||
hour,
|
||||
):
|
||||
"""Insert an instance with invalid data."""
|
||||
orig_timestamp = getattr(replayed_order, column)
|
||||
|
|
@ -436,7 +479,8 @@ class TestConstraints:
|
|||
db_session.add(replayed_order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='business_hours',
|
||||
sa_exc.IntegrityError,
|
||||
match='business_hours',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -493,7 +537,10 @@ class TestConstraints:
|
|||
],
|
||||
)
|
||||
def test_timestamps_unordered(
|
||||
self, db_session, replayed_order, comparison,
|
||||
self,
|
||||
db_session,
|
||||
replayed_order,
|
||||
comparison,
|
||||
):
|
||||
"""Insert an instance with invalid data.
|
||||
|
||||
|
|
@ -522,7 +569,9 @@ class TestConstraints:
|
|||
# choose one second after a quarter of an hour.
|
||||
replayed_pre_order.placed_at = dt.datetime(*test_config.DATE, 11, 45, 1)
|
||||
self.test_timestamps_unordered(
|
||||
db_session, replayed_pre_order, 'placed_at < scheduled_delivery_at',
|
||||
db_session,
|
||||
replayed_pre_order,
|
||||
'placed_at < scheduled_delivery_at',
|
||||
)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
@ -539,7 +588,10 @@ class TestConstraints:
|
|||
],
|
||||
)
|
||||
def test_timestamps_unordered_cancelled(
|
||||
self, db_session, replayed_order, comparison,
|
||||
self,
|
||||
db_session,
|
||||
replayed_order,
|
||||
comparison,
|
||||
):
|
||||
"""Insert an instance with invalid data.
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ class TestConstraints:
|
|||
db_session.delete(address)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='fk_addresses_to_addresses_via_primary_id',
|
||||
sa_exc.IntegrityError,
|
||||
match='fk_addresses_to_addresses_via_primary_id',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -59,7 +60,8 @@ class TestConstraints:
|
|||
stmt = sqla.delete(db.City).where(db.City.id == address.city.id)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='fk_addresses_to_cities_via_city_id',
|
||||
sa_exc.IntegrityError,
|
||||
match='fk_addresses_to_cities_via_city_id',
|
||||
):
|
||||
db_session.execute(stmt)
|
||||
|
||||
|
|
@ -70,7 +72,8 @@ class TestConstraints:
|
|||
db_session.add(address)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='latitude_between_90_degrees',
|
||||
sa_exc.IntegrityError,
|
||||
match='latitude_between_90_degrees',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -81,7 +84,8 @@ class TestConstraints:
|
|||
db_session.add(address)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='longitude_between_180_degrees',
|
||||
sa_exc.IntegrityError,
|
||||
match='longitude_between_180_degrees',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ def another_address(make_address):
|
|||
def path(address, another_address, make_address):
|
||||
"""A `Path` from `address` to `another_address`."""
|
||||
air_distance = distance.great_circle( # noqa:WPS317
|
||||
address.location.lat_lng, another_address.location.lat_lng,
|
||||
address.location.lat_lng,
|
||||
another_address.location.lat_lng,
|
||||
).meters
|
||||
|
||||
# We put 5 latitude-longitude pairs as the "path" from
|
||||
|
|
@ -190,7 +191,8 @@ class TestConstraints:
|
|||
db_session.add(path)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='realistic_bicycle_travel_time',
|
||||
sa_exc.IntegrityError,
|
||||
match='realistic_bicycle_travel_time',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -214,7 +216,10 @@ class TestFromAddresses:
|
|||
|
||||
@pytest.mark.usefixtures('_prepare_db')
|
||||
def test_make_path_instance(
|
||||
self, db_session, address, another_address,
|
||||
self,
|
||||
db_session,
|
||||
address,
|
||||
another_address,
|
||||
):
|
||||
"""Test instantiation of a new `Path` instance."""
|
||||
assert db_session.query(db.Path).count() == 0
|
||||
|
|
@ -225,7 +230,10 @@ class TestFromAddresses:
|
|||
|
||||
@pytest.mark.usefixtures('_prepare_db')
|
||||
def test_make_the_same_path_instance_twice(
|
||||
self, db_session, address, another_address,
|
||||
self,
|
||||
db_session,
|
||||
address,
|
||||
another_address,
|
||||
):
|
||||
"""Test instantiation of a new `Path` instance."""
|
||||
assert db_session.query(db.Path).count() == 0
|
||||
|
|
@ -247,7 +255,10 @@ class TestFromAddresses:
|
|||
|
||||
@pytest.mark.usefixtures('_prepare_db')
|
||||
def test_instances_must_have_air_distance(
|
||||
self, db_session, address, another_address,
|
||||
self,
|
||||
db_session,
|
||||
address,
|
||||
another_address,
|
||||
):
|
||||
"""Test instantiation of a new `Path` instance."""
|
||||
paths = db.Path.from_addresses(address, another_address)
|
||||
|
|
@ -258,7 +269,10 @@ class TestFromAddresses:
|
|||
|
||||
@pytest.mark.usefixtures('_prepare_db')
|
||||
def test_do_not_sync_instances_with_google_maps(
|
||||
self, db_session, address, another_address,
|
||||
self,
|
||||
db_session,
|
||||
address,
|
||||
another_address,
|
||||
):
|
||||
"""Test instantiation of a new `Path` instance."""
|
||||
paths = db.Path.from_addresses(address, another_address)
|
||||
|
|
@ -270,7 +284,11 @@ class TestFromAddresses:
|
|||
|
||||
@pytest.mark.usefixtures('_prepare_db')
|
||||
def test_sync_instances_with_google_maps(
|
||||
self, db_session, address, another_address, monkeypatch,
|
||||
self,
|
||||
db_session,
|
||||
address,
|
||||
another_address,
|
||||
monkeypatch,
|
||||
):
|
||||
"""Test instantiation of a new `Path` instance."""
|
||||
|
||||
|
|
@ -312,7 +330,9 @@ class TestFromAddresses:
|
|||
|
||||
@pytest.mark.usefixtures('_prepare_db')
|
||||
def test_make_path_instance_from_order(
|
||||
self, db_session, order,
|
||||
self,
|
||||
db_session,
|
||||
order,
|
||||
):
|
||||
"""Test instantiation of a new `Path` instance."""
|
||||
assert db_session.query(db.Path).count() == 0
|
||||
|
|
@ -323,7 +343,9 @@ class TestFromAddresses:
|
|||
|
||||
@pytest.mark.usefixtures('_prepare_db')
|
||||
def test_make_the_same_path_instance_from_order_twice(
|
||||
self, db_session, order,
|
||||
self,
|
||||
db_session,
|
||||
order,
|
||||
):
|
||||
"""Test instantiation of a new `Path` instance."""
|
||||
assert db_session.query(db.Path).count() == 0
|
||||
|
|
@ -345,7 +367,10 @@ class TestFromAddresses:
|
|||
|
||||
@pytest.mark.usefixtures('_prepare_db')
|
||||
def test_sync_instance_from_order_with_google_maps(
|
||||
self, db_session, order, monkeypatch,
|
||||
self,
|
||||
db_session,
|
||||
order,
|
||||
monkeypatch,
|
||||
):
|
||||
"""Test instantiation of a new `Path` instance."""
|
||||
|
||||
|
|
|
|||
|
|
@ -79,13 +79,17 @@ class TestConstraints:
|
|||
stmt = sqla.delete(db.Pixel).where(db.Pixel.id == forecast.pixel.id)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='fk_forecasts_to_pixels_via_pixel_id',
|
||||
sa_exc.IntegrityError,
|
||||
match='fk_forecasts_to_pixels_via_pixel_id',
|
||||
):
|
||||
db_session.execute(stmt)
|
||||
|
||||
@pytest.mark.parametrize('hour', [10, 23])
|
||||
def test_invalid_start_at_outside_operating_hours(
|
||||
self, db_session, forecast, hour,
|
||||
self,
|
||||
db_session,
|
||||
forecast,
|
||||
hour,
|
||||
):
|
||||
"""Insert an instance with invalid data."""
|
||||
forecast.start_at = dt.datetime(
|
||||
|
|
@ -97,7 +101,8 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='within_operating_hours',
|
||||
sa_exc.IntegrityError,
|
||||
match='within_operating_hours',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -107,7 +112,8 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='must_be_quarters_of_the_hour',
|
||||
sa_exc.IntegrityError,
|
||||
match='must_be_quarters_of_the_hour',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -117,7 +123,8 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='no_seconds',
|
||||
sa_exc.IntegrityError,
|
||||
match='no_seconds',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -127,7 +134,8 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='no_microseconds',
|
||||
sa_exc.IntegrityError,
|
||||
match='no_microseconds',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -138,7 +146,8 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='time_step_must_be_positive',
|
||||
sa_exc.IntegrityError,
|
||||
match='time_step_must_be_positive',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -149,7 +158,8 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='training_horizon_must_be_positive',
|
||||
sa_exc.IntegrityError,
|
||||
match='training_horizon_must_be_positive',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -159,7 +169,8 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='actuals_must_be_non_negative',
|
||||
sa_exc.IntegrityError,
|
||||
match='actuals_must_be_non_negative',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -184,7 +195,8 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='ci_upper_and_lower_bounds',
|
||||
sa_exc.IntegrityError,
|
||||
match='ci_upper_and_lower_bounds',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -196,7 +208,8 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='ci_upper_and_lower_bounds',
|
||||
sa_exc.IntegrityError,
|
||||
match='ci_upper_and_lower_bounds',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -208,7 +221,8 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='ci_upper_and_lower_bounds',
|
||||
sa_exc.IntegrityError,
|
||||
match='ci_upper_and_lower_bounds',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -220,7 +234,8 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='ci_upper_and_lower_bounds',
|
||||
sa_exc.IntegrityError,
|
||||
match='ci_upper_and_lower_bounds',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -233,12 +248,15 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='prediction_must_be_within_ci',
|
||||
sa_exc.IntegrityError,
|
||||
match='prediction_must_be_within_ci',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
def test_prediction_smaller_than_low80_without_ci95_set(
|
||||
self, db_session, forecast,
|
||||
self,
|
||||
db_session,
|
||||
forecast,
|
||||
):
|
||||
"""Insert an instance with invalid data."""
|
||||
forecast.low95 = None
|
||||
|
|
@ -248,7 +266,8 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='prediction_must_be_within_ci',
|
||||
sa_exc.IntegrityError,
|
||||
match='prediction_must_be_within_ci',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -261,12 +280,15 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='prediction_must_be_within_ci',
|
||||
sa_exc.IntegrityError,
|
||||
match='prediction_must_be_within_ci',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
def test_prediction_smaller_than_low95_without_ci80_set(
|
||||
self, db_session, forecast,
|
||||
self,
|
||||
db_session,
|
||||
forecast,
|
||||
):
|
||||
"""Insert an instance with invalid data."""
|
||||
forecast.low80 = None
|
||||
|
|
@ -276,7 +298,8 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='prediction_must_be_within_ci',
|
||||
sa_exc.IntegrityError,
|
||||
match='prediction_must_be_within_ci',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -289,12 +312,15 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='prediction_must_be_within_ci',
|
||||
sa_exc.IntegrityError,
|
||||
match='prediction_must_be_within_ci',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
def test_prediction_greater_than_high80_without_ci95_set(
|
||||
self, db_session, forecast,
|
||||
self,
|
||||
db_session,
|
||||
forecast,
|
||||
):
|
||||
"""Insert an instance with invalid data."""
|
||||
forecast.low95 = None
|
||||
|
|
@ -304,7 +330,8 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='prediction_must_be_within_ci',
|
||||
sa_exc.IntegrityError,
|
||||
match='prediction_must_be_within_ci',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -317,12 +344,15 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='prediction_must_be_within_ci',
|
||||
sa_exc.IntegrityError,
|
||||
match='prediction_must_be_within_ci',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
def test_prediction_greater_than_high95_without_ci80_set(
|
||||
self, db_session, forecast,
|
||||
self,
|
||||
db_session,
|
||||
forecast,
|
||||
):
|
||||
"""Insert an instance with invalid data."""
|
||||
forecast.low80 = None
|
||||
|
|
@ -332,7 +362,8 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='prediction_must_be_within_ci',
|
||||
sa_exc.IntegrityError,
|
||||
match='prediction_must_be_within_ci',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -353,7 +384,8 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='ci_upper_bound_greater_than_lower_bound',
|
||||
sa_exc.IntegrityError,
|
||||
match='ci_upper_bound_greater_than_lower_bound',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -374,7 +406,8 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='ci_upper_bound_greater_than_lower_bound',
|
||||
sa_exc.IntegrityError,
|
||||
match='ci_upper_bound_greater_than_lower_bound',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -388,7 +421,8 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='ci95_must_be_wider_than_ci80',
|
||||
sa_exc.IntegrityError,
|
||||
match='ci95_must_be_wider_than_ci80',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -405,7 +439,8 @@ class TestConstraints:
|
|||
db_session.add(forecast)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='ci95_must_be_wider_than_ci80',
|
||||
sa_exc.IntegrityError,
|
||||
match='ci95_must_be_wider_than_ci80',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -490,7 +525,10 @@ class TestFromDataFrameConstructor:
|
|||
|
||||
@pytest.mark.db
|
||||
def test_persist_predictions_into_database(
|
||||
self, db_session, pixel, prediction_data,
|
||||
self,
|
||||
db_session,
|
||||
pixel,
|
||||
prediction_data,
|
||||
):
|
||||
"""Call `Forecast.from_dataframe()` and persist the results."""
|
||||
forecasts = db.Forecast.from_dataframe(
|
||||
|
|
|
|||
|
|
@ -44,7 +44,8 @@ class TestConstraints:
|
|||
stmt = sqla.delete(db.City).where(db.City.id == grid.city.id)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='fk_grids_to_cities_via_city_id',
|
||||
sa_exc.IntegrityError,
|
||||
match='fk_grids_to_cities_via_city_id',
|
||||
):
|
||||
db_session.execute(stmt)
|
||||
|
||||
|
|
@ -206,7 +207,13 @@ class TestGridification:
|
|||
@pytest.mark.no_cover
|
||||
@pytest.mark.parametrize('side_length', [250, 500, 1_000, 2_000, 4_000, 8_000])
|
||||
def test_make_random_grids( # noqa:WPS211,WPS218
|
||||
self, db_session, city, make_address, make_restaurant, make_order, side_length,
|
||||
self,
|
||||
db_session,
|
||||
city,
|
||||
make_address,
|
||||
make_restaurant,
|
||||
make_order,
|
||||
side_length,
|
||||
):
|
||||
"""With 100 random `Address` objects, a grid must have ...
|
||||
|
||||
|
|
|
|||
|
|
@ -127,7 +127,8 @@ class TestConstraints:
|
|||
db_session.add(order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='either_ad_hoc_or_scheduled_order',
|
||||
sa_exc.IntegrityError,
|
||||
match='either_ad_hoc_or_scheduled_order',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -141,7 +142,8 @@ class TestConstraints:
|
|||
db_session.add(pre_order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='either_ad_hoc_or_scheduled_order',
|
||||
sa_exc.IntegrityError,
|
||||
match='either_ad_hoc_or_scheduled_order',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -152,7 +154,8 @@ class TestConstraints:
|
|||
db_session.add(order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='ad_hoc_orders_within_business_hours',
|
||||
sa_exc.IntegrityError,
|
||||
match='ad_hoc_orders_within_business_hours',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -163,20 +166,23 @@ class TestConstraints:
|
|||
db_session.add(order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='ad_hoc_orders_within_business_hours',
|
||||
sa_exc.IntegrityError,
|
||||
match='ad_hoc_orders_within_business_hours',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
def test_scheduled_order_way_too_early(self, db_session, make_order):
|
||||
"""Insert an instance with invalid data."""
|
||||
pre_order = make_order(
|
||||
scheduled=True, scheduled_delivery_at=dt.datetime(*test_config.DATE, 10, 0),
|
||||
scheduled=True,
|
||||
scheduled_delivery_at=dt.datetime(*test_config.DATE, 10, 0),
|
||||
)
|
||||
|
||||
db_session.add(pre_order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='scheduled_orders_within_business_hours',
|
||||
sa_exc.IntegrityError,
|
||||
match='scheduled_orders_within_business_hours',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -190,7 +196,8 @@ class TestConstraints:
|
|||
db_session.add(pre_order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='scheduled_orders_within_business_hours',
|
||||
sa_exc.IntegrityError,
|
||||
match='scheduled_orders_within_business_hours',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -214,25 +221,32 @@ class TestConstraints:
|
|||
def test_scheduled_order_too_late(self, db_session, make_order):
|
||||
"""Insert an instance with invalid data."""
|
||||
pre_order = make_order(
|
||||
scheduled=True, scheduled_delivery_at=dt.datetime(*test_config.DATE, 23, 0),
|
||||
scheduled=True,
|
||||
scheduled_delivery_at=dt.datetime(*test_config.DATE, 23, 0),
|
||||
)
|
||||
|
||||
db_session.add(pre_order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='scheduled_orders_within_business_hours',
|
||||
sa_exc.IntegrityError,
|
||||
match='scheduled_orders_within_business_hours',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
@pytest.mark.parametrize('minute', [min_ for min_ in range(60) if min_ % 15 != 0])
|
||||
def test_scheduled_order_at_non_quarter_of_an_hour(
|
||||
self, db_session, make_order, minute,
|
||||
self,
|
||||
db_session,
|
||||
make_order,
|
||||
minute,
|
||||
):
|
||||
"""Insert an instance with invalid data."""
|
||||
pre_order = make_order(
|
||||
scheduled=True,
|
||||
scheduled_delivery_at=dt.datetime( # `minute` is not 0, 15, 30, or 45
|
||||
*test_config.DATE, test_config.NOON, minute,
|
||||
*test_config.DATE,
|
||||
test_config.NOON,
|
||||
minute,
|
||||
),
|
||||
)
|
||||
|
||||
|
|
@ -246,13 +260,19 @@ class TestConstraints:
|
|||
|
||||
@pytest.mark.parametrize('second', list(range(1, 60)))
|
||||
def test_scheduled_order_at_non_quarter_of_an_hour_by_seconds(
|
||||
self, db_session, make_order, second,
|
||||
self,
|
||||
db_session,
|
||||
make_order,
|
||||
second,
|
||||
):
|
||||
"""Insert an instance with invalid data."""
|
||||
pre_order = make_order(
|
||||
scheduled=True,
|
||||
scheduled_delivery_at=dt.datetime(
|
||||
*test_config.DATE, test_config.NOON, 0, second,
|
||||
*test_config.DATE,
|
||||
test_config.NOON,
|
||||
0,
|
||||
second,
|
||||
),
|
||||
)
|
||||
|
||||
|
|
@ -288,7 +308,8 @@ class TestConstraints:
|
|||
db_session.add(pre_order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='scheduled_orders_not_within_30_minutes',
|
||||
sa_exc.IntegrityError,
|
||||
match='scheduled_orders_not_within_30_minutes',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -304,7 +325,8 @@ class TestConstraints:
|
|||
db_session.add(order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='only_cancelled_orders_may_have_cancelled_at',
|
||||
sa_exc.IntegrityError,
|
||||
match='only_cancelled_orders_may_have_cancelled_at',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -317,7 +339,8 @@ class TestConstraints:
|
|||
db_session.add(order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='cancelled_orders_must_not_be_delivered',
|
||||
sa_exc.IntegrityError,
|
||||
match='cancelled_orders_must_not_be_delivered',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -328,20 +351,25 @@ class TestConstraints:
|
|||
db_session.add(order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='between_0_and_2700',
|
||||
sa_exc.IntegrityError,
|
||||
match='between_0_and_2700',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
@pytest.mark.parametrize('duration', [1, 59, 119, 2699])
|
||||
def test_estimated_prep_duration_not_whole_minute(
|
||||
self, db_session, order, duration,
|
||||
self,
|
||||
db_session,
|
||||
order,
|
||||
duration,
|
||||
):
|
||||
"""Insert an instance with invalid data."""
|
||||
order.estimated_prep_duration = duration
|
||||
db_session.add(order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='must_be_whole_minutes',
|
||||
sa_exc.IntegrityError,
|
||||
match='must_be_whole_minutes',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -352,7 +380,8 @@ class TestConstraints:
|
|||
db_session.add(order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='between_0_and_900',
|
||||
sa_exc.IntegrityError,
|
||||
match='between_0_and_900',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -363,7 +392,8 @@ class TestConstraints:
|
|||
db_session.add(order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='must_be_whole_minutes',
|
||||
sa_exc.IntegrityError,
|
||||
match='must_be_whole_minutes',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -374,7 +404,8 @@ class TestConstraints:
|
|||
db_session.add(order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='between_0_and_100',
|
||||
sa_exc.IntegrityError,
|
||||
match='between_0_and_100',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -393,7 +424,10 @@ class TestConstraints:
|
|||
],
|
||||
)
|
||||
def test_unset_timestamp_column_not_marked_as_uncorrected( # noqa:WPS213
|
||||
self, db_session, order, column,
|
||||
self,
|
||||
db_session,
|
||||
order,
|
||||
column,
|
||||
):
|
||||
"""Insert an instance with invalid data.
|
||||
|
||||
|
|
@ -421,12 +455,15 @@ class TestConstraints:
|
|||
db_session.add(order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='corrections_only_for_set_value',
|
||||
sa_exc.IntegrityError,
|
||||
match='corrections_only_for_set_value',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
def test_unset_timestamp_column_not_marked_as_uncorrected_special_case1(
|
||||
self, db_session, order,
|
||||
self,
|
||||
db_session,
|
||||
order,
|
||||
):
|
||||
"""Insert an instance with invalid data.
|
||||
|
||||
|
|
@ -434,11 +471,15 @@ class TestConstraints:
|
|||
"""
|
||||
order.pickup_not_confirmed = None
|
||||
self.test_unset_timestamp_column_not_marked_as_uncorrected(
|
||||
db_session, order, 'pickup_at',
|
||||
db_session,
|
||||
order,
|
||||
'pickup_at',
|
||||
)
|
||||
|
||||
def test_unset_timestamp_column_not_marked_as_uncorrected_special_case2(
|
||||
self, db_session, order,
|
||||
self,
|
||||
db_session,
|
||||
order,
|
||||
):
|
||||
"""Insert an instance with invalid data.
|
||||
|
||||
|
|
@ -447,7 +488,9 @@ class TestConstraints:
|
|||
order.delivery_not_confirmed = None
|
||||
order._courier_waited_at_delivery = None
|
||||
self.test_unset_timestamp_column_not_marked_as_uncorrected(
|
||||
db_session, order, 'delivery_at',
|
||||
db_session,
|
||||
order,
|
||||
'delivery_at',
|
||||
)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
@ -465,7 +508,10 @@ class TestConstraints:
|
|||
],
|
||||
)
|
||||
def test_set_timestamp_column_is_not_unmarked( # noqa:WPS213
|
||||
self, db_session, order, column,
|
||||
self,
|
||||
db_session,
|
||||
order,
|
||||
column,
|
||||
):
|
||||
"""Insert an instance with invalid data.
|
||||
|
||||
|
|
@ -493,23 +539,30 @@ class TestConstraints:
|
|||
db_session.add(order)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='corrections_only_for_set_value',
|
||||
sa_exc.IntegrityError,
|
||||
match='corrections_only_for_set_value',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
def test_set_timestamp_column_is_not_unmarked_special_case1(
|
||||
self, db_session, pre_order,
|
||||
self,
|
||||
db_session,
|
||||
pre_order,
|
||||
):
|
||||
"""Insert an instance with invalid data.
|
||||
|
||||
This is one of two special cases. See the generic case above.
|
||||
"""
|
||||
self.test_set_timestamp_column_is_not_unmarked(
|
||||
db_session, pre_order, 'scheduled_delivery_at',
|
||||
db_session,
|
||||
pre_order,
|
||||
'scheduled_delivery_at',
|
||||
)
|
||||
|
||||
def test_set_timestamp_column_is_not_unmarked_special_case2(
|
||||
self, db_session, order,
|
||||
self,
|
||||
db_session,
|
||||
order,
|
||||
):
|
||||
"""Insert an instance with invalid data.
|
||||
|
||||
|
|
@ -524,7 +577,9 @@ class TestConstraints:
|
|||
order._courier_waited_at_delivery = None
|
||||
|
||||
self.test_set_timestamp_column_is_not_unmarked(
|
||||
db_session, order, 'cancelled_at',
|
||||
db_session,
|
||||
order,
|
||||
'cancelled_at',
|
||||
)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
@ -575,7 +630,10 @@ class TestConstraints:
|
|||
],
|
||||
)
|
||||
def test_timestamps_unordered(
|
||||
self, db_session, order, comparison,
|
||||
self,
|
||||
db_session,
|
||||
order,
|
||||
comparison,
|
||||
):
|
||||
"""Insert an instance with invalid data.
|
||||
|
||||
|
|
@ -604,7 +662,9 @@ class TestConstraints:
|
|||
# choose one second after a quarter of an hour.
|
||||
pre_order.placed_at = dt.datetime(*test_config.DATE, 11, 45, 1)
|
||||
self.test_timestamps_unordered(
|
||||
db_session, pre_order, 'placed_at < scheduled_delivery_at',
|
||||
db_session,
|
||||
pre_order,
|
||||
'placed_at < scheduled_delivery_at',
|
||||
)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
@ -623,7 +683,10 @@ class TestConstraints:
|
|||
],
|
||||
)
|
||||
def test_timestamps_unordered_cancelled(
|
||||
self, db_session, order, comparison,
|
||||
self,
|
||||
db_session,
|
||||
order,
|
||||
comparison,
|
||||
):
|
||||
"""Insert an instance with invalid data.
|
||||
|
||||
|
|
@ -1021,7 +1084,11 @@ class TestProperties:
|
|||
@pytest.mark.db
|
||||
@pytest.mark.no_cover
|
||||
def test_make_random_orders( # noqa:C901,WPS211,WPS213
|
||||
db_session, make_address, make_courier, make_restaurant, make_order,
|
||||
db_session,
|
||||
make_address,
|
||||
make_courier,
|
||||
make_restaurant,
|
||||
make_order,
|
||||
):
|
||||
"""Sanity check the all the `make_*` fixtures.
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,8 @@ class TestConstraints:
|
|||
stmt = sqla.delete(db.Grid).where(db.Grid.id == pixel.grid.id)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='fk_pixels_to_grids_via_grid_id',
|
||||
sa_exc.IntegrityError,
|
||||
match='fk_pixels_to_grids_via_grid_id',
|
||||
):
|
||||
db_session.execute(stmt)
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,8 @@ class TestConstraints:
|
|||
stmt = sqla.delete(db.Address).where(db.Address.id == restaurant.address.id)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='fk_restaurants_to_addresses_via_address_id',
|
||||
sa_exc.IntegrityError,
|
||||
match='fk_restaurants_to_addresses_via_address_id',
|
||||
):
|
||||
db_session.execute(stmt)
|
||||
|
||||
|
|
@ -54,7 +55,8 @@ class TestConstraints:
|
|||
db_session.add(restaurant)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='realistic_estimated_prep_duration',
|
||||
sa_exc.IntegrityError,
|
||||
match='realistic_estimated_prep_duration',
|
||||
):
|
||||
db_session.commit()
|
||||
|
||||
|
|
@ -64,6 +66,7 @@ class TestConstraints:
|
|||
db_session.add(restaurant)
|
||||
|
||||
with pytest.raises(
|
||||
sa_exc.IntegrityError, match='realistic_estimated_prep_duration',
|
||||
sa_exc.IntegrityError,
|
||||
match='realistic_estimated_prep_duration',
|
||||
):
|
||||
db_session.commit()
|
||||
|
|
|
|||
|
|
@ -80,7 +80,9 @@ class TestSpecialMethods:
|
|||
assert result is False
|
||||
|
||||
def test_compare_utm_coordinates_to_far_away_coordinates(
|
||||
self, location, faraway_location,
|
||||
self,
|
||||
location,
|
||||
faraway_location,
|
||||
):
|
||||
"""Test `Location.__eq__()`."""
|
||||
with pytest.raises(ValueError, match='must be in the same zone'):
|
||||
|
|
@ -173,7 +175,9 @@ class TestRelateTo:
|
|||
location.relate_to(object())
|
||||
|
||||
def test_call_relate_to_with_far_away_other(
|
||||
self, location, faraway_location,
|
||||
self,
|
||||
location,
|
||||
faraway_location,
|
||||
):
|
||||
"""The `other` origin must be in the same UTM zone."""
|
||||
with pytest.raises(ValueError, match='must be in the same zone'):
|
||||
|
|
|
|||
Loading…
Reference in a new issue