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
This commit is contained in:
Davide Andreoli 2018-11-28 20:16:19 +01:00
parent a10eda5137
commit 433b561e27
2 changed files with 10 additions and 9 deletions

View File

@ -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):

View File

@ -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')