From 8b5ea7e8aec176bb42fb0e569add4637ba223349 Mon Sep 17 00:00:00 2001 From: Dave Andreoli Date: Wed, 28 Nov 2018 20:16:19 +0100 Subject: [PATCH] Pyolian tests: 2 small improvements 1. properly use unittest infra to skip tests, otherwise we will forgot the commented tests 2. split the new name collision test (failing, but really cool) so it have a proper name and the results are more readable --- src/scripts/pyolian/eolian.py | 2 -- src/scripts/pyolian/test_eolian.py | 17 ++++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py index 5a57676..49d288d 100644 --- a/src/scripts/pyolian/eolian.py +++ b/src/scripts/pyolian/eolian.py @@ -389,7 +389,6 @@ class Eolian_Unit(EolianBaseObject): c_tdecl = lib.eolian_unit_alias_by_name_get(self, _str_to_bytes(name)) return Typedecl(c_tdecl) if c_tdecl else None - @property def all_namespaces(self): # TODO find a better way to find namespaces (maybe inside eolian?) @@ -530,7 +529,6 @@ class Namespace(object): deep = self._name.count('.') + 1 return [ ns for ns in self._unit.all_namespaces if ns.name.startswith(base) and ns.name.count('.') == deep ] - @property def classes(self): diff --git a/src/scripts/pyolian/test_eolian.py b/src/scripts/pyolian/test_eolian.py index 0ed27c2..a1ab85b 100755 --- a/src/scripts/pyolian/test_eolian.py +++ b/src/scripts/pyolian/test_eolian.py @@ -97,11 +97,11 @@ class TestEolianUnit(unittest.TestCase): self.assertIsInstance(unit, eolian.Eolian_Unit) self.assertEqual(unit.file, 'efl_ui_win.eo') - # Commented out until unit/state support is fixed - # def test_children_listing(self): - # l = list(eolian_db.children) - # self.assertGreater(len(l), 500) - # self.assertIsInstance(l[0], eolian.Eolian_Unit) + @unittest.skip('Skipped until unit/state support is fixed') + def test_children_listing(self): + l = list(eolian_db.children) + self.assertGreater(len(l), 500) + self.assertIsInstance(l[0], eolian.Eolian_Unit) def test_file_listing(self): l = list(eolian_db.eo_file_paths) @@ -210,11 +210,14 @@ class TestEolianNamespace(unittest.TestCase): count = 0 for ns in eolian_db.all_namespaces: self.assertIsInstance(ns, eolian.Namespace) - cls = eolian_db.class_by_name_get(ns.name) - self.assertIsNone(cls) count += 1 self.assertGreater(count, 100) + def test_namespace_vs_class_collision(self): + for ns in eolian_db.all_namespaces: + cls = eolian_db.class_by_name_get(ns.name) + self.assertIsNone(cls) + def test_namespace_equality(self): ns1 = eolian.Namespace(eolian_db, 'Efl.Io') ns2 = eolian.Namespace(eolian_db, 'Efl.Net') -- 2.7.4