From 6ee5c1dfb8ec2e0d161843577dafc9a6f481690f Mon Sep 17 00:00:00 2001
From: Reimar Leike <reimar@mpa-garching.mpg.de>
Date: Thu, 11 May 2017 12:02:29 +0200
Subject: [PATCH] catches expected exceptions

---
 test/test_spaces/test_power_space.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/test/test_spaces/test_power_space.py b/test/test_spaces/test_power_space.py
index 4e8951ab9..a791b6388 100644
--- a/test/test_spaces/test_power_space.py
+++ b/test/test_spaces/test_power_space.py
@@ -114,11 +114,18 @@ class PowerSpaceConsistencyCheck(unittest.TestCase):
     def test_pipundexInversion(self, harmonic_partner, distribution_strategy,
                          logarithmic, nbin, binbounds, expected):
         #expected will not be used TODO: write expandproduct to use for this
-        p = PowerSpace(harmonic_partner=harmonic_partner,
+        if 'error' in expected:
+            with assert_raises(expected['error']):
+                PowerSpace(harmonic_partner=harmonic_partner,
+                           distribution_strategy=distribution_strategy,
+                           logarithmic=logarithmic, nbin=nbin,
+                           binbounds=binbounds)
+        else:
+            p = PowerSpace(harmonic_partner=harmonic_partner,
                            distribution_strategy=distribution_strategy,
                            logarithmic=logarithmic, nbin=nbin,
                            binbounds=binbounds)
-        assert_equal(p.pindex[p.pundex],np.arange(p.dim),err_msg='pundex is not right-inverse of pindex!')
+            assert_equal(p.pindex[p.pundex],np.arange(p.dim),err_msg='pundex is not right-inverse of pindex!')
 
 class PowerSpaceFunctionalityTest(unittest.TestCase):
     @expand(CONSTRUCTOR_CONFIGS)
-- 
GitLab