From 7f3355b175041f6e854627b79a0c494580102bf2 Mon Sep 17 00:00:00 2001 From: BO ZHANG <bozhang@nao.cas.cn> Date: Tue, 4 Oct 2022 16:17:46 +0800 Subject: [PATCH] added unit test for CsstStatus --- csst_common/status.py | 7 ------- tests/test_status.py | 9 +++++++++ 2 files changed, 9 insertions(+), 7 deletions(-) create mode 100644 tests/test_status.py diff --git a/csst_common/status.py b/csst_common/status.py index e0fa806..f3f0165 100644 --- a/csst_common/status.py +++ b/csst_common/status.py @@ -19,10 +19,3 @@ class CsstStatus(IntEnum): # def __repr__(self): # return '<%s.%s>' % (self.__class__.__name__, self.name) - - -if __name__ == "__main__": - print(CsstStatus) - print(CsstStatus.PROBLEMATIC) - print(CsstStatus(1)) - print(CsstStatus(1) == CsstStatus.PROBLEMATIC) diff --git a/tests/test_status.py b/tests/test_status.py new file mode 100644 index 0000000..b39fc9c --- /dev/null +++ b/tests/test_status.py @@ -0,0 +1,9 @@ +import unittest +from csst_common.status import CsstStatus + + +class TestParams(unittest.TestCase): + def test_params(self): + self.assertTrue(CsstStatus(0) == CsstStatus.PERFECT) + self.assertTrue(CsstStatus(1) == CsstStatus.WARNING) + self.assertTrue(CsstStatus(2) == CsstStatus.ERROR) -- GitLab