-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #170 from jgrewe/terminology
Extensions to the terminology handling
- Loading branch information
Showing
3 changed files
with
246 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import unittest | ||
import odml | ||
|
||
class TestTerminolgies(unittest.TestCase): | ||
def setUp(self): | ||
pass | ||
|
||
def test_load(self): | ||
if not odml.terminology.terminologies.empty(): | ||
odml.terminology.terminologies.clear() | ||
self.assertTrue(odml.terminology.terminologies.empty()) | ||
|
||
def test_cached_files(self): | ||
odml.terminology.clear_cache() | ||
self.assertTrue(len(odml.terminology.cached_files()) == 0) | ||
odml.terminology.load() | ||
self.assertTrue(len(odml.terminology.cached_files()) > 0) | ||
|
||
def test_from_cache(self): | ||
if not odml.terminology.terminologies.empty(): | ||
odml.terminology.terminologies.clear() | ||
odml.terminology.from_cache(odml.terminology.terminologies) | ||
self.assertTrue(odml.terminology.terminologies.empty() == False) | ||
|
||
def test_find_difinitions(self): | ||
if odml.terminology.terminologies.empty(): | ||
odml.terminology.from_cache(odml.terminology.terminologies) | ||
|
||
self.assertTrue(len(odml.terminology.find_definitions("analysis")) > 0) | ||
self.assertTrue(len(odml.terminology.find_definitions("foo")) == 0) | ||
|
||
def test_get_section(self): | ||
self.assertIsNone(odml.terminology.get_section_by_type("analyses")) | ||
self.assertIsNotNone(odml.terminology.get_section_by_type("analysis")) | ||
self.assertIsInstance(odml.terminology.get_section_by_type("analysis"), odml.section.BaseSection) | ||
self.assertIsNone(odml.terminology.get_section_by_type("analysis", "!g-node")) | ||
self.assertTrue(len((odml.terminology.get_section_by_type("setup/daq", "g-node"))) > 0) | ||
|