Rename test to tests; fix equator length.

This commit is contained in:
Sergey Vartanov 2021-09-02 02:33:11 +03:00
parent f744c601d0
commit ba26c1d4d7
19 changed files with 71 additions and 33 deletions

25
tests/test_flinger.py Normal file
View file

@ -0,0 +1,25 @@
"""
Test coordinates computation.
"""
import numpy as np
from roentgen.flinger import osm_zoom_level_to_pixels_per_meter, pseudo_mercator
__author__ = "Sergey Vartanov"
__email__ = "me@enzet.ru"
def test_pseudo_mercator() -> None:
"""Test pseudo-Mercator projection."""
assert np.allclose(pseudo_mercator(np.array((0, 0))), np.array((0, 0)))
assert np.allclose(pseudo_mercator(np.array((0, 10))), np.array((10, 0)))
assert np.allclose(
pseudo_mercator(np.array((10, 0))), np.array((0, 10.05115966))
)
def test_osm_zoom_level_to_pixels_per_meter() -> None:
"""Test scale computation."""
assert np.allclose(
osm_zoom_level_to_pixels_per_meter(18), 1.6745810488364858
)