Skip to content

Commit a95c77d

Browse files
Corrected import and added test for networkx graph attributes
1 parent 1685b75 commit a95c77d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os
44
from setuptools import setup
55

6-
version = '0.0.20'
6+
version = '0.0.21'
77

88
classifiers = [
99
"Development Status :: 3 - Alpha",

tests/test.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from django.test import TestCase
66
from django.core.exceptions import ValidationError
7-
from django_postgresql_dag.models import NodeNotReachableException, GraphModelsCannotBeParsedException, IncorrectUsageException
7+
from django_postgresql_dag.exceptions import NodeNotReachableException, GraphModelsCannotBeParsedException, IncorrectUsageException
88
from django_postgresql_dag.transformations import _filter_order, edges_from_nodes_queryset, nodes_from_edges_queryset, nx_from_queryset, model_to_dict
99

1010
# from .dag_output import expected_dag_output
@@ -229,8 +229,13 @@ def test_02_dag(self):
229229
self.assertFalse(c1.is_island())
230230

231231
# Test is we can properly export to a NetworkX graph
232+
log = logging.getLogger("test_02_networkx")
232233
nx_out = nx_from_queryset(c1.ancestors_and_self(), graph_attributes_dict={"test": "test"}, node_attribute_fields_list=["id", "name"], edge_attribute_fields_list=["id", "name"])
234+
log.debug("Check attributes")
233235
self.assertEqual(nx_out.graph, {"test": "test"})
236+
self.assertEqual(nx_out.nodes[11], {'id': 11, 'name': 'root'})
237+
self.assertEqual(nx_out.edges[11, 14], {'id': 4, 'name': 'root a3'})
238+
234239

235240
"""
236241
Simulate a basic irrigation canal network

0 commit comments

Comments
 (0)