Skip to content

Commit

Permalink
test: test hier graph and path generation
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjayankur31 committed Sep 8, 2023
1 parent 6f1d5f9 commit 63dc4cf
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions neuroml/test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
Copyright 2023 NeuroML contributors
"""

import neuroml
from neuroml.utils import component_factory
import unittest
import tempfile

import neuroml
from neuroml.utils import (component_factory, get_relative_component_path,
print_hierarchy)


class UtilsTestCase(unittest.TestCase):
Expand Down Expand Up @@ -42,3 +43,13 @@ def test_component_factory_should_fail(self):
"IafCell",
id="test_cell",
)

def test_networkx_hier_graph(self):
"""Test constructing a networkx graph of a hierarchy"""
hier = neuroml.NeuroMLDocument.get_class_hierarchy()
self.assertIsNotNone(hier)
print_hierarchy(hier)

path, graph = get_relative_component_path("Input", "Instance")
self.assertIsNotNone(graph)
self.assertEqual(path, "../Population/Instance")

0 comments on commit 63dc4cf

Please sign in to comment.