mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-02-05 20:35:10 -05:00
Restructuring the Repo to make it clear the difference between classic autogpt and the autogpt platform: * Move the "classic" projects `autogpt`, `forge`, `frontend`, and `benchmark` into a `classic` folder * Also rename `autogpt` to `original_autogpt` for absolute clarity * Rename `rnd/` to `autogpt_platform/` * `rnd/autogpt_builder` -> `autogpt_platform/frontend` * `rnd/autogpt_server` -> `autogpt_platform/backend` * Adjust any paths accordingly
58 lines
1.5 KiB
Python
58 lines
1.5 KiB
Python
from agbenchmark.utils.dependencies.graphs import get_roots
|
|
|
|
|
|
def test_get_roots():
|
|
graph = {
|
|
"nodes": [
|
|
{"id": "A", "data": {"category": []}},
|
|
{"id": "B", "data": {"category": []}},
|
|
{"id": "C", "data": {"category": []}},
|
|
{"id": "D", "data": {"category": []}},
|
|
],
|
|
"edges": [
|
|
{"from": "A", "to": "B"},
|
|
{"from": "B", "to": "C"},
|
|
],
|
|
}
|
|
|
|
result = get_roots(graph)
|
|
assert set(result) == {
|
|
"A",
|
|
"D",
|
|
}, f"Expected roots to be 'A' and 'D', but got {result}"
|
|
|
|
|
|
def test_no_roots():
|
|
fully_connected_graph = {
|
|
"nodes": [
|
|
{"id": "A", "data": {"category": []}},
|
|
{"id": "B", "data": {"category": []}},
|
|
{"id": "C", "data": {"category": []}},
|
|
],
|
|
"edges": [
|
|
{"from": "A", "to": "B"},
|
|
{"from": "B", "to": "C"},
|
|
{"from": "C", "to": "A"},
|
|
],
|
|
}
|
|
|
|
result = get_roots(fully_connected_graph)
|
|
assert not result, "Expected no roots, but found some"
|
|
|
|
|
|
# def test_no_rcoots():
|
|
# fully_connected_graph = {
|
|
# "nodes": [
|
|
# {"id": "A", "data": {"category": []}},
|
|
# {"id": "B", "data": {"category": []}},
|
|
# {"id": "C", "data": {"category": []}},
|
|
# ],
|
|
# "edges": [
|
|
# {"from": "A", "to": "B"},
|
|
# {"from": "D", "to": "C"},
|
|
# ],
|
|
# }
|
|
#
|
|
# result = get_roots(fully_connected_graph)
|
|
# assert set(result) == {"A"}, f"Expected roots to be 'A', but got {result}"
|