Add Address.x and Address.y coordinates
- the Address.x and Address.y properties use the UTMCoordinate class behind the scenes - x and y are simple coordinates in an x-y plane - the (0, 0) origin is the southwest corner of Address.city.viewport
This commit is contained in:
parent
6f9935072e
commit
6cb4be80f6
5 changed files with 69 additions and 1 deletions
|
|
@ -122,3 +122,15 @@ class TestProperties:
|
|||
result = address.is_primary
|
||||
|
||||
assert result is False
|
||||
|
||||
def test_x_is_positive(self, address):
|
||||
"""Test `Address.x` property."""
|
||||
result = address.x
|
||||
|
||||
assert result > 0
|
||||
|
||||
def test_y_is_positive(self, address):
|
||||
"""Test `Address.y` property."""
|
||||
result = address.y
|
||||
|
||||
assert result > 0
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
import pytest
|
||||
|
||||
from tests.db.utils import test_coordinates as consts
|
||||
from urban_meal_delivery import db
|
||||
|
||||
|
||||
|
|
@ -63,3 +64,11 @@ class TestProperties:
|
|||
assert len(result) == 2
|
||||
assert result['latitude'] == pytest.approx(city_data[f'_{corner}_latitude'])
|
||||
assert result['longitude'] == pytest.approx(city_data[f'_{corner}_longitude'])
|
||||
|
||||
def test_city_in_utm_coordinates(self, city):
|
||||
"""Test `City.as_origin` property."""
|
||||
result = city.as_origin
|
||||
|
||||
assert result.zone == consts.ZONE
|
||||
assert consts.MIN_EASTING < result.easting < consts.MAX_EASTING
|
||||
assert consts.MIN_NORTHING < result.northing < consts.MAX_NORTHING
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue