From c65e1b06d45b7b3403620e145257a3bb622c558f Mon Sep 17 00:00:00 2001
From: Reimar Leike <reimar@mpa-garching.mpg.de>
Date: Thu, 11 May 2017 11:47:07 +0200
Subject: [PATCH] added a consistency test for pundex pindex inversion

---
 test/test_spaces/test_power_space.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/test/test_spaces/test_power_space.py b/test/test_spaces/test_power_space.py
index 652d37b39..4e8951ab9 100644
--- a/test/test_spaces/test_power_space.py
+++ b/test/test_spaces/test_power_space.py
@@ -109,6 +109,16 @@ class PowerSpaceInterfaceTest(unittest.TestCase):
         p = PowerSpace(r)
         assert_(isinstance(getattr(p, attribute), expected_type))
 
+class PowerSpaceConsistencyCheck(unittest.TestCase):
+    @expand(CONSTRUCTOR_CONFIGS)
+    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,
+                           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!')
 
 class PowerSpaceFunctionalityTest(unittest.TestCase):
     @expand(CONSTRUCTOR_CONFIGS)
-- 
GitLab