Skip to content

Commit 1685b75

Browse files
Corrected import and began testing NetworkX graph exports
1 parent c4e18b1 commit 1685b75

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

django_postgresql_dag/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from django.core.exceptions import ValidationError
1919

2020
from .exceptions import NodeNotReachableException
21-
from .transformations import *
21+
from .transformations import _filter_order
2222

2323
LIMITING_FK_EDGES_CLAUSE_1 = (
2424
"""AND second.{fk_field_name}_{pk_name} = %(limiting_fk_edges_instance_pk)s"""

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.19'
6+
version = '0.0.20'
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,8 @@
44

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

910
# from .dag_output import expected_dag_output
1011
from .models import NetworkNode, NetworkEdge
@@ -226,6 +227,10 @@ def test_02_dag(self):
226227
log.debug("ancestors")
227228
self.assertEqual([p.name for p in c1.ancestors()], ["root", "a3", "b4"])
228229
self.assertFalse(c1.is_island())
230+
231+
# Test is we can properly export to a NetworkX graph
232+
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"])
233+
self.assertEqual(nx_out.graph, {"test": "test"})
229234

230235
"""
231236
Simulate a basic irrigation canal network

0 commit comments

Comments
 (0)