Skip to content

Commit

Permalink
fixes #34
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed Nov 14, 2019
1 parent 5f2eed6 commit 2f67112
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ def suite(*args, **kw):
from tests import test_cli
from tests import test_output_handler
from tests import test_simple
from tests import test_symbols
from tests import test_testDisplay

test_list = [
test_simple,
test_symbols,
test_adl_parser,
test_cli,
test_output_handler,
Expand Down
68 changes: 68 additions & 0 deletions tests/test_symbols.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

"""
unit tests for module: symbols
"""

import logging
import os
import shutil
import sys
import tempfile
import unittest

# turn off logging output
logging.basicConfig(level=logging.CRITICAL)

_test_path = os.path.dirname(__file__)
_path = os.path.join(_test_path, '..', 'src')
if _path not in sys.path:
sys.path.insert(0, _path)

from adl2pydm import symbols


class Test_Module(unittest.TestCase):

# def setUp(self): ...

# def tearDown(self): ...

def test_symbols(self):
self.assertEqual(len(symbols.adl_widgets), 24)

self.assertIsInstance(symbols.adl_widgets, dict)
for k, w in symbols.adl_widgets.items():
self.assertIsInstance(w, dict)
self.assertEqual(len(w), 2)
# "arc" : dict(type="static", pydm_widget="PyDMDrawingArc"),
w = symbols.adl_widgets["arc"]
self.assertEqual(w["type"], "static")
self.assertEqual(w["pydm_widget"], "PyDMDrawingArc")
self.assertEqual(w["type"], "static")

self.assertEqual(len(symbols.pydm_widgets), 32)
self.assertIsInstance(symbols.pydm_widgets, dict)
for k, w in symbols.pydm_widgets.items():
self.assertIsInstance(w, symbols.PyDM_CustomWidget)
self.assertEqual(len(w), 3)
# PyDMLabel = PyDM_CustomWidget("PyDMLabel", "QLabel", "pydm.widgets.label"),
w = symbols.pydm_widgets["PyDMLabel"]
self.assertEqual(w.cls, "PyDMLabel")
self.assertEqual(w.extends, "QLabel")
self.assertEqual(w.header, "pydm.widgets.label")



def suite(*args, **kw):
test_suite = unittest.TestSuite()
test_list = [
Test_Module,
]
for test_case in test_list:
test_suite.addTest(unittest.makeSuite(test_case))
return test_suite


if __name__ == "__main__":
runner=unittest.TextTestRunner()
runner.run(suite())

0 comments on commit 2f67112

Please sign in to comment.