Skip to content

Commit e95146a

Browse files
committed
logscale axes tests
1 parent 3b1ed0e commit e95146a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/test_coords_converter.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,28 @@ def test_from_pixel_linear(x_px, y_px, x_factual, y_factual, tolerance):
2727
x_result, y_result = converter.from_pixel(x_pixel=x_px, y_pixel=y_px)
2828
assert abs(x_result - x_factual) < tolerance
2929
assert abs(y_result - y_factual) < tolerance
30+
31+
32+
@pytest.mark.parametrize(
33+
"x_px, y_px, x_factual, y_factual, tolerance",
34+
[(80.5, 364, 24669, 80872, 1), (280.5, 217, 10151633, 9838022, 1)],
35+
)
36+
def test_from_pixel_logscale(x_px, y_px, x_factual, y_factual, tolerance):
37+
converter = CoordinatesConverter()
38+
39+
converter.set_parameters(
40+
x_min_px=127,
41+
x_max_px=433,
42+
y_min_px=428,
43+
y_max_px=146,
44+
x_min_factual=1e5,
45+
x_max_factual=1e9,
46+
y_min_factual=1e4,
47+
y_max_factual=1e8,
48+
x_axis_type=AxisType.LOGSCALE,
49+
y_axis_type=AxisType.LOGSCALE,
50+
)
51+
52+
x_result, y_result = converter.from_pixel(x_pixel=x_px, y_pixel=y_px)
53+
assert abs(x_result - x_factual) < tolerance
54+
assert abs(y_result - y_factual) < tolerance

0 commit comments

Comments
 (0)