cddb07a176
docs / deploy (push) Has been cancelled
docs / changes (push) Has been cancelled
docs / check-and-build (push) Has been cancelled
build container image / cpu (push) Has been cancelled
build container image / cuda (push) Has been cancelled
build container image / rocm (push) Has been cancelled
frontend checks / frontend-checks (push) Has been cancelled
frontend tests / frontend-tests (push) Has been cancelled
lfs checks / lfs-check (push) Has been cancelled
python checks / python-checks (push) Has been cancelled
python tests / py3.12: macos-default (push) Has been cancelled
python tests / py3.11: windows-cpu (push) Has been cancelled
python tests / py3.12: windows-cpu (push) Has been cancelled
python tests / py3.11: linux-cpu (push) Has been cancelled
typegen checks / typegen-checks (push) Has been cancelled
uv lock checks / uv-lock-checks (push) Has been cancelled
openapi checks / openapi-checks (push) Has been cancelled
python tests / py3.11: macos-default (push) Has been cancelled
python tests / py3.12: linux-cpu (push) Has been cancelled
20 lines
526 B
Python
20 lines
526 B
Python
import math
|
|
|
|
import pytest
|
|
|
|
from invokeai.backend.util.build_line import build_line
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
["x1", "y1", "x2", "y2", "x3", "y3"],
|
|
[
|
|
(0, 0, 1, 1, 2, 2), # y = x
|
|
(0, 1, 1, 2, 2, 3), # y = x + 1
|
|
(0, 0, 1, 2, 2, 4), # y = 2x
|
|
(0, 1, 1, 0, 2, -1), # y = -x + 1
|
|
(0, 5, 1, 5, 2, 5), # y = 0
|
|
],
|
|
)
|
|
def test_build_line(x1: float, y1: float, x2: float, y2: float, x3: float, y3: float):
|
|
assert math.isclose(build_line(x1, y1, x2, y2)(x3), y3, rel_tol=1e-9)
|