ludwig-ai--ludwig
593b94c120
pytest / Unit Tests (push) Has been cancelled
pytest / Integration (integration_tests_a) (push) Has been cancelled
pytest / Integration (integration_tests_b) (push) Has been cancelled
pytest / Integration (integration_tests_c) (push) Has been cancelled
pytest / Integration (integration_tests_d) (push) Has been cancelled
pytest / Integration (integration_tests_e) (push) Has been cancelled
pytest / Integration (integration_tests_f) (push) Has been cancelled
pytest / Integration (integration_tests_g) (push) Has been cancelled
pytest / Integration (integration_tests_h) (push) Has been cancelled
pytest / Integration (integration_tests_i) (push) Has been cancelled
pytest / Integration (integration_tests_j) (push) Has been cancelled
pytest / Distributed (distributed_a) (push) Has been cancelled
pytest / Distributed (distributed_b) (push) Has been cancelled
pytest / Distributed (distributed_c) (push) Has been cancelled
pytest / Distributed (distributed_d) (push) Has been cancelled
pytest / Distributed (distributed_e) (push) Has been cancelled
pytest / Distributed (distributed_f) (push) Has been cancelled
pytest / Minimal Install (push) Has been cancelled
pytest / Event File (push) Has been cancelled
pytest (slow) / py-slow (push) Has been cancelled
Publish JSON Schema / publish-schema (push) Has been cancelled
21 行
725 B
Python
21 行
725 B
Python
import pytest
|
|
|
|
from ludwig.utils.algorithms_utils import topological_sort
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"unsorted,sorted",
|
|
[
|
|
(
|
|
[(2, []), (5, [11]), (11, [2, 9, 10]), (7, [11, 8]), (9, []), (10, []), (8, [9]), (3, [10, 8])],
|
|
[(2, []), (9, []), (10, []), (8, [9]), (3, [10, 8]), (11, [2, 9, 10]), (7, [11, 8]), (5, [11])],
|
|
),
|
|
(
|
|
[("macro", ["action", "contact_type"]), ("contact_type", None), ("action", ["contact_type"])],
|
|
[("contact_type", []), ("action", ["contact_type"]), ("macro", ["action", "contact_type"])],
|
|
),
|
|
],
|
|
)
|
|
def test_topological_sort(unsorted: list, sorted: list) -> None:
|
|
assert topological_sort(unsorted) == sorted
|