You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
897 B
42 lines
897 B
import pytest |
|
import main |
|
|
|
|
|
@pytest.fixture(autouse=True) |
|
def patch_log(monkeypatch): |
|
monkeypatch.setattr(main, "log", lambda msg: None) |
|
monkeypatch.setattr(main, "logvv", lambda msg: None) |
|
|
|
|
|
def test_find_geo_extrama_simpple(): |
|
data = [ |
|
[0, 'dummy', (50.1, 8.1) ], |
|
[1, 'dummy', (50.2, 8.2) ], |
|
[2, 'dummy', (50.3, 8.4) ], |
|
[3, 'dummy', (49.3, 8.4) ], |
|
[4, 'dummy', (49.3, 7.4) ] |
|
] |
|
|
|
result = main.find_geo_extrema(data) |
|
expected = (49.3, 50.3, 7.4, 8.4) |
|
assert result == expected |
|
|
|
|
|
def test_find_geo_extrama_single(): |
|
data = [ |
|
[0, 'dummy', (50.1, 8.1) ] |
|
] |
|
|
|
result = main.find_geo_extrema(data) |
|
expected = (50.1, 50.1, 8.1, 8.1) |
|
assert result == expected |
|
|
|
|
|
def test_find_geo_extrama_empty(): |
|
data = [ |
|
] |
|
|
|
result = main.find_geo_extrema(data) |
|
expected = None |
|
assert result == expected |
|
|
|
|