Add ORM models for the pixel grids
- add Grid, Pixel, and AddressPixelAssociation ORM models - each Grid belongs to a City an is characterized by the side_length of all the square Pixels contained in it - Pixels aggregate Addresses => many-to-many relationship (that is modeled with SQLAlchemy's Association Pattern to implement a couple of constraints)
This commit is contained in:
parent
6cb4be80f6
commit
f996376b13
15 changed files with 665 additions and 36 deletions
|
|
@ -56,3 +56,15 @@ def restaurant(address, make_restaurant):
|
|||
def order(make_order, restaurant):
|
||||
"""An `Order` object for the `restaurant`."""
|
||||
return make_order(restaurant=restaurant)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def grid(city):
|
||||
"""A `Grid` with a pixel area of 1 square kilometer."""
|
||||
return db.Grid(city=city, side_length=1000)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def pixel(grid):
|
||||
"""The `Pixel` in the lower-left corner of the `grid`."""
|
||||
return db.Pixel(grid=grid, n_x=0, n_y=0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue