diff options
author | Gemma Fardell <gfardell@stfc.ac.uk> | 2019-06-21 16:53:45 +0100 |
---|---|---|
committer | Gemma Fardell <gfardell@stfc.ac.uk> | 2019-06-21 16:53:45 +0100 |
commit | b83fdeb39c1eb7a5e05fb7326a543079cb6b7d27 (patch) | |
tree | 543d282e75721a8f06efb61e2efa82fa5d097942 | |
parent | 438dd964e312debf1ba72d8def5caaf290548c04 (diff) | |
download | framework-b83fdeb39c1eb7a5e05fb7326a543079cb6b7d27.tar.gz framework-b83fdeb39c1eb7a5e05fb7326a543079cb6b7d27.tar.bz2 framework-b83fdeb39c1eb7a5e05fb7326a543079cb6b7d27.tar.xz framework-b83fdeb39c1eb7a5e05fb7326a543079cb6b7d27.zip |
Added unittests for test data
-rwxr-xr-x | Wrappers/Python/test/test_TestData.py | 78 |
1 files changed, 71 insertions, 7 deletions
diff --git a/Wrappers/Python/test/test_TestData.py b/Wrappers/Python/test/test_TestData.py index 3b26612..c4a0a70 100755 --- a/Wrappers/Python/test/test_TestData.py +++ b/Wrappers/Python/test/test_TestData.py @@ -1,19 +1,83 @@ - import numpy from ccpi.framework import TestData import os, sys -sys.path.append( os.path.dirname( os.path.abspath(__file__) ) ) + +sys.path.append(os.path.dirname(os.path.abspath(__file__))) from testclass import CCPiTestClass class TestTestData(CCPiTestClass): def test_random_noise(self): - #loader = TestData(data_dir=os.path.join(sys.prefix, 'share','ccpi')) - #data_dir=os.path.join(os.path.dirname(__file__),'..', 'data') + # loader = TestData(data_dir=os.path.join(sys.prefix, 'share','ccpi')) + # data_dir=os.path.join(os.path.dirname(__file__),'..', 'data') loader = TestData() - camera = loader.load(TestData.CAMERA) - noisy_camera = TestData.random_noise(camera, seed=1) - norm = (camera-noisy_camera).norm() + norm = (camera - noisy_camera).norm() self.assertAlmostEqual(norm, 48.881268, places=4) + + def test_load_CAMERA(self): + loader = TestData() + image = loader.load(TestData.CAMERA) + + if image: + res = True + else: + res = False + + self.assertTrue(res) + + def test_load_BOAT(self): + loader = TestData() + image = loader.load(TestData.BOAT) + + if image: + res = True + else: + res = False + + self.assertTrue(res) + + def test_load_PEPPERS(self): + loader = TestData() + image = loader.load(TestData.PEPPERS) + + if image: + res = True + else: + res = False + + self.assertTrue(res) + + def test_load_RESOLUTION_CHART(self): + loader = TestData() + image = loader.load(TestData.RESOLUTION_CHART) + + if image: + res = True + else: + res = False + + self.assertTrue(res) + + def test_load_SIMPLE_PHANTOM_2D(self): + loader = TestData() + image = loader.load(TestData.SIMPLE_PHANTOM_2D) + + if image: + res = True + else: + res = False + + self.assertTrue(res) + + def test_load_SHAPES(self): + loader = TestData() + image = loader.load(TestData.SHAPES) + + if image: + res = True + else: + res = False + + self.assertTrue(res) |