From 64c0c61ee3842ea63921ebb73827333d91cf99cc Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Fri, 17 Jul 2020 02:47:31 +0300 Subject: Add basic unittests --- test/unittest/base/test_general_object.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/unittest/base/test_general_object.py (limited to 'test/unittest/base/test_general_object.py') diff --git a/test/unittest/base/test_general_object.py b/test/unittest/base/test_general_object.py new file mode 100644 index 00000000..eaefdec9 --- /dev/null +++ b/test/unittest/base/test_general_object.py @@ -0,0 +1,21 @@ +import unittest + +from wqflask.base.GeneralObject import GeneralObject + + +class TestGeneralObjectTests(unittest.TestCase): + """ + Test the GeneralObject base class + """ + + def test_object_contents(self): + """Test whether base contents are stored properly""" + test_obj = GeneralObject("a", "b", "c") + self.assertEqual("abc", ''.join(test_obj.contents)) + + def test_object_dict(self): + """Test whether the base class is printed properly""" + test_obj = GeneralObject("a", name="test", value=1) + self.assertEqual(str(test_obj), "value = 1\nname = test\n") + self.assertEqual( + repr(test_obj), "value = 1\nname = test\ncontents = ['a']\n") -- cgit v1.2.3 From 3d6483e8fd59d2e77149aa5d78ec32448be7338c Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Tue, 21 Jul 2020 22:46:49 +0300 Subject: Move tests to module * test/unittest/: Move to wqflask/tests/ --- test/unittest/__init__.py | 0 test/unittest/base/__init__.py | 0 test/unittest/base/test_data_set.py | 8 -------- test/unittest/base/test_general_object.py | 21 --------------------- wqflask/tests/__init__.py | 0 wqflask/tests/base/__init__.py | 0 wqflask/tests/base/test_general_object.py | 21 +++++++++++++++++++++ 7 files changed, 21 insertions(+), 29 deletions(-) delete mode 100644 test/unittest/__init__.py delete mode 100644 test/unittest/base/__init__.py delete mode 100644 test/unittest/base/test_data_set.py delete mode 100644 test/unittest/base/test_general_object.py create mode 100644 wqflask/tests/__init__.py create mode 100644 wqflask/tests/base/__init__.py create mode 100644 wqflask/tests/base/test_general_object.py (limited to 'test/unittest/base/test_general_object.py') diff --git a/test/unittest/__init__.py b/test/unittest/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/test/unittest/base/__init__.py b/test/unittest/base/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/test/unittest/base/test_data_set.py b/test/unittest/base/test_data_set.py deleted file mode 100644 index 6537efa6..00000000 --- a/test/unittest/base/test_data_set.py +++ /dev/null @@ -1,8 +0,0 @@ -import unittest - -import wqflask.base.data_set -print dir() - -class TestDataSet(unittest.TestCase): - def test_add(self): - self.assertEqual(3, 4) diff --git a/test/unittest/base/test_general_object.py b/test/unittest/base/test_general_object.py deleted file mode 100644 index eaefdec9..00000000 --- a/test/unittest/base/test_general_object.py +++ /dev/null @@ -1,21 +0,0 @@ -import unittest - -from wqflask.base.GeneralObject import GeneralObject - - -class TestGeneralObjectTests(unittest.TestCase): - """ - Test the GeneralObject base class - """ - - def test_object_contents(self): - """Test whether base contents are stored properly""" - test_obj = GeneralObject("a", "b", "c") - self.assertEqual("abc", ''.join(test_obj.contents)) - - def test_object_dict(self): - """Test whether the base class is printed properly""" - test_obj = GeneralObject("a", name="test", value=1) - self.assertEqual(str(test_obj), "value = 1\nname = test\n") - self.assertEqual( - repr(test_obj), "value = 1\nname = test\ncontents = ['a']\n") diff --git a/wqflask/tests/__init__.py b/wqflask/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/wqflask/tests/base/__init__.py b/wqflask/tests/base/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/wqflask/tests/base/test_general_object.py b/wqflask/tests/base/test_general_object.py new file mode 100644 index 00000000..699cb079 --- /dev/null +++ b/wqflask/tests/base/test_general_object.py @@ -0,0 +1,21 @@ +import unittest + +from base.GeneralObject import GeneralObject + + +class TestGeneralObjectTests(unittest.TestCase): + """ + Test the GeneralObject base class + """ + + def test_object_contents(self): + """Test whether base contents are stored properly""" + test_obj = GeneralObject("a", "b", "c") + self.assertEqual("abc", ''.join(test_obj.contents)) + + def test_object_dict(self): + """Test whether the base class is printed properly""" + test_obj = GeneralObject("a", name="test", value=1) + self.assertEqual(str(test_obj), "value = 1\nname = test\n") + self.assertEqual( + repr(test_obj), "value = 1\nname = test\ncontents = ['a']\n") -- cgit v1.2.3 From 8e3756b8b8094c5d025da31c54c1d0d95a55b0dc Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Fri, 17 Jul 2020 02:47:31 +0300 Subject: Add basic unittests --- test/unittest/__init__.py | 0 test/unittest/base/__init__.py | 0 test/unittest/base/test_general_object.py | 21 +++++++++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 test/unittest/__init__.py create mode 100644 test/unittest/base/__init__.py create mode 100644 test/unittest/base/test_general_object.py (limited to 'test/unittest/base/test_general_object.py') diff --git a/test/unittest/__init__.py b/test/unittest/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/unittest/base/__init__.py b/test/unittest/base/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/unittest/base/test_general_object.py b/test/unittest/base/test_general_object.py new file mode 100644 index 00000000..eaefdec9 --- /dev/null +++ b/test/unittest/base/test_general_object.py @@ -0,0 +1,21 @@ +import unittest + +from wqflask.base.GeneralObject import GeneralObject + + +class TestGeneralObjectTests(unittest.TestCase): + """ + Test the GeneralObject base class + """ + + def test_object_contents(self): + """Test whether base contents are stored properly""" + test_obj = GeneralObject("a", "b", "c") + self.assertEqual("abc", ''.join(test_obj.contents)) + + def test_object_dict(self): + """Test whether the base class is printed properly""" + test_obj = GeneralObject("a", name="test", value=1) + self.assertEqual(str(test_obj), "value = 1\nname = test\n") + self.assertEqual( + repr(test_obj), "value = 1\nname = test\ncontents = ['a']\n") -- cgit v1.2.3 From 5eb26c5a209f3a3c54cf6fe623e5372188bdd1bc Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Sat, 25 Jul 2020 00:59:46 +0300 Subject: Update import statement in test_general_object.py * test/unittest/base/test_general_object.py: replace the import statement to use the module path instead of the path referenced from PYTHONPATH --- test/unittest/base/test_general_object.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/unittest/base/test_general_object.py') diff --git a/test/unittest/base/test_general_object.py b/test/unittest/base/test_general_object.py index eaefdec9..699cb079 100644 --- a/test/unittest/base/test_general_object.py +++ b/test/unittest/base/test_general_object.py @@ -1,6 +1,6 @@ import unittest -from wqflask.base.GeneralObject import GeneralObject +from base.GeneralObject import GeneralObject class TestGeneralObjectTests(unittest.TestCase): -- cgit v1.2.3