Remove periods from one-sentence comments
This commit is contained in:
parent
454c2898a0
commit
049a5f6f62
1 changed files with 308 additions and 308 deletions
|
|
@ -40,7 +40,7 @@ class TestConstraints:
|
|||
db_session.add(grid)
|
||||
db_session.commit()
|
||||
|
||||
# Must delete without ORM as otherwise an UPDATE statement is emitted.
|
||||
# Must delete without ORM as otherwise an UPDATE statement is emitted
|
||||
stmt = sa.delete(db.City).where(db.City.id == grid.city.id)
|
||||
|
||||
with pytest.raises(
|
||||
|
|
@ -54,7 +54,7 @@ class TestConstraints:
|
|||
db_session.add(grid)
|
||||
db_session.commit()
|
||||
|
||||
# Create a `Grid` with the same `.side_length` in the same `.city`.
|
||||
# Create a `Grid` with the same `.side_length` in the same `.city`
|
||||
another_grid = db.Grid(city=grid.city, side_length=grid.side_length)
|
||||
db_session.add(another_grid)
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ class TestConstraints:
|
|||
db_session.add(grid)
|
||||
db_session.commit()
|
||||
|
||||
# Create a `Grid` with the same `.side_length` in another `.city`.
|
||||
# Create a `Grid` with the same `.side_length` in another `.city`
|
||||
another_city = db.City(**(city_data | {"id": 2, "name": "Lyon"}))
|
||||
another_grid = db.Grid(city=another_city, side_length=grid.side_length)
|
||||
db_session.add(another_grid)
|
||||
|
|
@ -132,7 +132,7 @@ class TestGridification:
|
|||
"""
|
||||
addresses_mock.return_value = [order.pickup_address]
|
||||
|
||||
# `+1` as otherwise there would be a second pixel in one direction.
|
||||
# `+1` as otherwise there would be a second pixel in one direction
|
||||
side_length = max(city.total_x, city.total_y) + 1
|
||||
|
||||
result = db.Grid.gridify(city=city, side_length=side_length)
|
||||
|
|
@ -152,7 +152,7 @@ class TestGridification:
|
|||
orders = [make_order(), make_order()]
|
||||
addresses_mock.return_value = [order.pickup_address for order in orders]
|
||||
|
||||
# `+1` as otherwise there would be a second pixel in one direction.
|
||||
# `+1` as otherwise there would be a second pixel in one direction
|
||||
side_length = max(city.total_x, city.total_y) + 1
|
||||
|
||||
result = db.Grid.gridify(city=city, side_length=side_length)
|
||||
|
|
@ -162,11 +162,11 @@ class TestGridification:
|
|||
|
||||
def test_no_pixel_with_one_address_too_far_south(self, city, order, addresses_mock):
|
||||
"""An `address` outside the `city`'s viewport is discarded."""
|
||||
# Move the `address` just below `city.southwest`.
|
||||
# Move the `address` just below `city.southwest`
|
||||
order.pickup_address.latitude = city.southwest.latitude - 0.1
|
||||
addresses_mock.return_value = [order.pickup_address]
|
||||
|
||||
# `+1` as otherwise there would be a second pixel in one direction.
|
||||
# `+1` as otherwise there would be a second pixel in one direction
|
||||
side_length = max(city.total_x, city.total_y) + 1
|
||||
|
||||
result = db.Grid.gridify(city=city, side_length=side_length)
|
||||
|
|
@ -181,11 +181,11 @@ class TestGridification:
|
|||
This test is a logical sibling to
|
||||
`test_no_pixel_with_one_address_too_far_south` and therefore redundant.
|
||||
"""
|
||||
# Move the `address` just left to `city.southwest`.
|
||||
# Move the `address` just left to `city.southwest`
|
||||
order.pickup_address.longitude = city.southwest.longitude - 0.1
|
||||
addresses_mock.return_value = [order.pickup_address]
|
||||
|
||||
# `+1` as otherwise there would be a second pixel in one direction.
|
||||
# `+1` as otherwise there would be a second pixel in one direction
|
||||
side_length = max(city.total_x, city.total_y) + 1
|
||||
|
||||
result = db.Grid.gridify(city=city, side_length=side_length)
|
||||
|
|
@ -199,7 +199,7 @@ class TestGridification:
|
|||
|
||||
This test is more of a sanity check.
|
||||
"""
|
||||
# Create two `Address` objects in distinct `Pixel`s.
|
||||
# Create two `Address` objects in distinct `Pixel`s
|
||||
addresses_mock.return_value = [
|
||||
# One `Address` in the lower-left `Pixel`, ...
|
||||
make_address(latitude=48.8357377, longitude=2.2517412),
|
||||
|
|
@ -209,12 +209,12 @@ class TestGridification:
|
|||
|
||||
side_length = max(city.total_x // 2, city.total_y // 2) + 1
|
||||
|
||||
# By assumption of the test data.
|
||||
# By assumption of the test data
|
||||
n_pixels_x = (city.total_x // side_length) + 1
|
||||
n_pixels_y = (city.total_y // side_length) + 1
|
||||
assert n_pixels_x * n_pixels_y == 4
|
||||
|
||||
# Create a `Grid` with at most four `Pixel`s.
|
||||
# Create a `Grid` with at most four `Pixel`s
|
||||
result = db.Grid.gridify(city=city, side_length=side_length)
|
||||
|
||||
assert isinstance(result, db.Grid)
|
||||
|
|
@ -252,7 +252,7 @@ class TestGridification:
|
|||
assert isinstance(result, db.Grid)
|
||||
assert 1 <= len(result.pixels) <= n_pixels_x * n_pixels_y
|
||||
|
||||
# Sanity checks for `Pixel.southwest` and `Pixel.northeast`.
|
||||
# Sanity checks for `Pixel.southwest` and `Pixel.northeast`
|
||||
for pixel in result.pixels:
|
||||
assert abs(pixel.southwest.x - pixel.n_x * side_length) < 2
|
||||
assert abs(pixel.southwest.y - pixel.n_y * side_length) < 2
|
||||
|
|
|
|||
Loading…
Reference in a new issue