Skip to content

Commit 7da0018

Browse files
fix: remove deprecated dj.ERD alias
- Remove ERD alias (use dj.Diagram) - Rename test_erd_algebra to test_diagram_algebra - Remove test_diagram_aliases test - Bump version to 2.0.0a21 Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent d928c6b commit 7da0018

File tree

4 files changed

+16
-30
lines changed

4 files changed

+16
-30
lines changed

src/datajoint/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"Top",
4040
"U",
4141
"Diagram",
42-
"ERD",
4342
"kill",
4443
"MatCell",
4544
"MatStruct",
@@ -94,7 +93,6 @@
9493
_lazy_modules = {
9594
# Diagram imports networkx and matplotlib
9695
"Diagram": (".diagram", "Diagram"),
97-
"ERD": (".diagram", "Diagram"),
9896
"diagram": (".diagram", None), # Return the module itself
9997
# kill imports pymysql via connection
10098
"kill": (".admin", "kill"),

src/datajoint/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# version bump auto managed by Github Actions:
22
# label_prs.yaml(prep), release.yaml(bump), post_release.yaml(edit)
33
# manually set this version will be eventually overwritten by the above actions
4-
__version__ = "2.0.0a20"
4+
__version__ = "2.0.0a21"

tests/integration/test_erd.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,33 @@ def test_dependencies(schema_simp):
2424

2525
def test_erd(schema_simp):
2626
assert dj.diagram.diagram_active, "Failed to import networkx and pydot"
27-
erd = dj.ERD(schema_simp, context=LOCALS_SIMPLE)
27+
erd = dj.Diagram(schema_simp, context=LOCALS_SIMPLE)
2828
graph = erd._make_graph()
2929
assert set(cls.__name__ for cls in (A, B, D, E, L)).issubset(graph.nodes())
3030

3131

32-
def test_erd_algebra(schema_simp):
33-
erd0 = dj.ERD(B)
34-
erd1 = erd0 + 3
35-
erd2 = dj.Diagram(E) - 3
36-
erd3 = erd1 * erd2
37-
erd4 = (erd0 + E).add_parts() - B - E
38-
assert erd0.nodes_to_show == set(cls.full_table_name for cls in [B])
39-
assert erd1.nodes_to_show == set(cls.full_table_name for cls in (B, B.C, E, E.F, E.G, E.H, E.M, G))
40-
assert erd2.nodes_to_show == set(cls.full_table_name for cls in (A, B, D, E, L))
41-
assert erd3.nodes_to_show == set(cls.full_table_name for cls in (B, E))
42-
assert erd4.nodes_to_show == set(cls.full_table_name for cls in (B.C, E.F, E.G, E.H, E.M))
32+
def test_diagram_algebra(schema_simp):
33+
"""Test Diagram algebra operations (+, -, *)."""
34+
diag0 = dj.Diagram(B)
35+
diag1 = diag0 + 3
36+
diag2 = dj.Diagram(E) - 3
37+
diag3 = diag1 * diag2
38+
diag4 = (diag0 + E).add_parts() - B - E
39+
assert diag0.nodes_to_show == set(cls.full_table_name for cls in [B])
40+
assert diag1.nodes_to_show == set(cls.full_table_name for cls in (B, B.C, E, E.F, E.G, E.H, E.M, G))
41+
assert diag2.nodes_to_show == set(cls.full_table_name for cls in (A, B, D, E, L))
42+
assert diag3.nodes_to_show == set(cls.full_table_name for cls in (B, E))
43+
assert diag4.nodes_to_show == set(cls.full_table_name for cls in (B.C, E.F, E.G, E.H, E.M))
4344

4445

4546
def test_repr_svg(schema_adv):
46-
erd = dj.ERD(schema_adv, context=dict())
47+
erd = dj.Diagram(schema_adv, context=dict())
4748
svg = erd._repr_svg_()
4849
assert svg.startswith("<svg") and svg.endswith("svg>")
4950

5051

5152
def test_make_image(schema_simp):
52-
erd = dj.ERD(schema_simp, context=dict())
53+
erd = dj.Diagram(schema_simp, context=dict())
5354
img = erd.make_image()
5455
assert img.ndim == 3 and img.shape[2] in (3, 4)
5556

tests/unit/test_lazy_imports.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,6 @@ def test_diagram_module_access():
8080
assert hasattr(diagram_module, "Diagram"), "diagram module should have Diagram class"
8181

8282

83-
def test_diagram_aliases():
84-
"""Di and ERD should be aliases for Diagram."""
85-
# Remove datajoint from sys.modules to get fresh import
86-
modules_to_remove = [key for key in sys.modules if key.startswith("datajoint")]
87-
for mod in modules_to_remove:
88-
del sys.modules[mod]
89-
90-
import datajoint as dj
91-
92-
# ERD alias should resolve to Diagram
93-
assert dj.Diagram is dj.ERD
94-
95-
9683
def test_core_imports_available():
9784
"""Core functionality should be available immediately after import."""
9885
# Remove datajoint from sys.modules to get fresh import

0 commit comments

Comments
 (0)