Skip to content

Commit

Permalink
add a test for dependencies.topo_sort()
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitri-yatsenko committed Sep 16, 2024
1 parent d5ab1a0 commit 6563ce9
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/test_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,26 @@ def test_nullable_dependency(thing_tables):
assert len(c) == len(c.fetch()) == 5


def test_topo_sort():
import networkx as nx
import datajoint as dj

graph = nx.DiGraph(
[
("`a`.`a`", "`a`.`m`"),
("`a`.`a`", "`a`.`z`"),
("`a`.`m`", "`a`.`m__part`"),
("`a`.`z`", "`a`.`m__part`"),
]
)
assert dj.dependencies.topo_sort(graph) == [
"`a`.`a`",
"`a`.`z`",
"`a`.`m`",
"`a`.`m__part`",
]


def test_unique_dependency(thing_tables):
"""test nullable unique foreign key"""
# Thing C has a nullable dependency on B whose primary key is composite
Expand Down

0 comments on commit 6563ce9

Please sign in to comment.