Skip to content

Commit abf20dc

Browse files
committed
cleanup
1 parent 1a1b18c commit abf20dc

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

tests/test.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,7 @@ def test_multidigraph_edges_crud(load_karate_graph: Any) -> None:
16381638
def test_graph_dict_init(load_karate_graph: Any) -> None:
16391639
G = nxadb.Graph(name="KarateGraph", default_node_type="person")
16401640
assert db.collection("_graphs").has("KarateGraph")
1641-
graph_document = db.collection("_graphs").get("KarateGraph")
1641+
graph_document = db.document(f"_graphs/{G.name}")
16421642
assert graph_document["_key"] == "KarateGraph"
16431643
assert graph_document["edgeDefinitions"] == [
16441644
{"collection": "knows", "from": ["person"], "to": ["person"]},
@@ -1679,9 +1679,7 @@ def test_graph_dict_clear_will_not_remove_remote_data(load_karate_graph: Any) ->
16791679

16801680

16811681
def test_graph_dict_set_item(load_karate_graph: Any) -> None:
1682-
name = "KarateGraph"
1683-
db.collection("_graphs").delete(name, ignore_missing=True)
1684-
G = nxadb.Graph(name=name, default_node_type="person")
1682+
G = nxadb.Graph(name="KarateGraph", default_node_type="person")
16851683

16861684
json_values = [
16871685
"aString",
@@ -1707,25 +1705,23 @@ def test_graph_dict_set_item(load_karate_graph: Any) -> None:
17071705

17081706
def test_graph_dict_update(load_karate_graph: Any) -> None:
17091707
G = nxadb.Graph(name="KarateGraph", default_node_type="person")
1710-
G.clear()
17111708

17121709
G.graph["a"] = "b"
17131710
to_update = {"c": "d"}
17141711
G.graph.update(to_update)
17151712

17161713
# local
1717-
assert G.graph["a"] == "b"
1718-
assert G.graph["c"] == "d"
1714+
assert G.graph.data["a"] == G.graph["a"] == "b"
1715+
assert G.graph.data["c"] == G.graph["c"] == "d"
17191716

17201717
# remote
1721-
adb_doc = db.collection("_graphs").get(G.name)
1718+
adb_doc = db.document(f"_graphs/{G.name}")["networkx"]
17221719
assert adb_doc["a"] == "b"
17231720
assert adb_doc["c"] == "d"
17241721

17251722

17261723
def test_graph_attr_dict_nested_update(load_karate_graph: Any) -> None:
17271724
G = nxadb.Graph(name="KarateGraph", default_node_type="person")
1728-
G.clear()
17291725

17301726
G.graph["a"] = {"b": "c"}
17311727
G.graph["a"].update({"d": "e"})
@@ -1737,7 +1733,6 @@ def test_graph_attr_dict_nested_update(load_karate_graph: Any) -> None:
17371733

17381734
def test_graph_dict_nested_1(load_karate_graph: Any) -> None:
17391735
G = nxadb.Graph(name="KarateGraph", default_node_type="person")
1740-
G.clear()
17411736
icon = {"football_icon": "MJ7"}
17421737

17431738
G.graph["a"] = {"b": icon}
@@ -1747,7 +1742,6 @@ def test_graph_dict_nested_1(load_karate_graph: Any) -> None:
17471742

17481743
def test_graph_dict_nested_2(load_karate_graph: Any) -> None:
17491744
G = nxadb.Graph(name="KarateGraph", default_node_type="person")
1750-
G.clear()
17511745
icon = {"football_icon": "MJ7"}
17521746

17531747
G.graph["x"] = {"y": icon}
@@ -1761,7 +1755,6 @@ def test_graph_dict_nested_2(load_karate_graph: Any) -> None:
17611755

17621756
def test_graph_dict_empty_values(load_karate_graph: Any) -> None:
17631757
G = nxadb.Graph(name="KarateGraph", default_node_type="person")
1764-
G.clear()
17651758

17661759
G.graph["empty"] = {}
17671760
assert G.graph["empty"] == {}
@@ -1774,7 +1767,6 @@ def test_graph_dict_empty_values(load_karate_graph: Any) -> None:
17741767

17751768
def test_graph_dict_nested_overwrite(load_karate_graph: Any) -> None:
17761769
G = nxadb.Graph(name="KarateGraph", default_node_type="person")
1777-
G.clear()
17781770
icon1 = {"football_icon": "MJ7"}
17791771
icon2 = {"basketball_icon": "MJ23"}
17801772

@@ -1796,7 +1788,6 @@ def test_graph_dict_nested_overwrite(load_karate_graph: Any) -> None:
17961788

17971789
def test_graph_dict_complex_nested(load_karate_graph: Any) -> None:
17981790
G = nxadb.Graph(name="KarateGraph", default_node_type="person")
1799-
G.clear()
18001791

18011792
complex_structure = {"level1": {"level2": {"level3": {"key": "value"}}}}
18021793

@@ -1812,7 +1803,6 @@ def test_graph_dict_complex_nested(load_karate_graph: Any) -> None:
18121803

18131804
def test_graph_dict_nested_deletion(load_karate_graph: Any) -> None:
18141805
G = nxadb.Graph(name="KarateGraph", default_node_type="person")
1815-
G.clear()
18161806
icon = {"football_icon": "MJ7", "amount_of_goals": 1337}
18171807

18181808
G.graph["x"] = {"y": icon}

0 commit comments

Comments
 (0)