summaryrefslogtreecommitdiffstats
path: root/Wrappers/Python
diff options
context:
space:
mode:
authorEdoardo Pasca <edo.paskino@gmail.com>2019-04-12 12:10:46 +0100
committerEdoardo Pasca <edo.paskino@gmail.com>2019-04-12 12:10:46 +0100
commit04c3f99648e38756e8180519db5f32ac3344ea2b (patch)
tree706eee5f8270762c7d32faef4e422116f1b1348a /Wrappers/Python
parent4049917fa20353da6f88ff03b7c5b11d67743a00 (diff)
downloadframework-04c3f99648e38756e8180519db5f32ac3344ea2b.tar.gz
framework-04c3f99648e38756e8180519db5f32ac3344ea2b.tar.bz2
framework-04c3f99648e38756e8180519db5f32ac3344ea2b.tar.xz
framework-04c3f99648e38756e8180519db5f32ac3344ea2b.zip
update test
Diffstat (limited to 'Wrappers/Python')
-rwxr-xr-xWrappers/Python/test/test_BlockDataContainer.py23
1 files changed, 19 insertions, 4 deletions
diff --git a/Wrappers/Python/test/test_BlockDataContainer.py b/Wrappers/Python/test/test_BlockDataContainer.py
index 2fca23c..0dd0657 100755
--- a/Wrappers/Python/test/test_BlockDataContainer.py
+++ b/Wrappers/Python/test/test_BlockDataContainer.py
@@ -136,12 +136,12 @@ class TestBlockDataContainer(unittest.TestCase):
print (a[0][0].shape)
#cp2 = BlockDataContainer(*a)
cp2 = cp0.add(cp1)
- assert (cp2.get_item(0).as_array()[0][0][0] == 2.)
- assert (cp2.get_item(1).as_array()[0][0][0] == 4.)
+ self.assertEqual (cp2.get_item(0).as_array()[0][0][0] , 2.)
+ self.assertEqual (cp2.get_item(1).as_array()[0][0][0] , 4.)
cp2 = cp0 + cp1
- assert (cp2.get_item(0).as_array()[0][0][0] == 2.)
- assert (cp2.get_item(1).as_array()[0][0][0] == 4.)
+ self.assertTrue (cp2.get_item(0).as_array()[0][0][0] == 2.)
+ self.assertTrue (cp2.get_item(1).as_array()[0][0][0] == 4.)
cp2 = cp0 + 1
numpy.testing.assert_almost_equal(cp2.get_item(0).as_array()[0][0][0] , 1. , decimal=5)
numpy.testing.assert_almost_equal(cp2.get_item(1).as_array()[0][0][0] , 2., decimal = 5)
@@ -427,6 +427,21 @@ class TestBlockDataContainer(unittest.TestCase):
cp0.fill(cp2)
self.assertBlockDataContainerEqual(cp0, cp2)
+ def test_NestedBlockDataContainer(self):
+ ig0 = ImageGeometry(2,3,4)
+ ig1 = ImageGeometry(2,3,5)
+
+ data0 = ig0.allocate(0)
+ data2 = ig0.allocate(1)
+
+ cp0 = BlockDataContainer(data0,data2)
+ #cp1 = BlockDataContainer(data2,data3)
+
+ nested = BlockDataContainer(cp0, data2, data2)
+ out = BlockDataContainer(BlockDataContainer(data0 , data0), data0, data0)
+ nested.divide(data2,out=out)
+ self.assertBlockDataContainerEqual(out, nested)
+
def assertBlockDataContainerEqual(self, container1, container2):
print ("assert Block Data Container Equal")