From 40aa33c13d9835bb627dfc0b6875693af50f43b4 Mon Sep 17 00:00:00 2001
From: hhakim <hakim.hadj-djilani@inria.fr>
Date: Fri, 27 May 2022 18:10:22 +0200
Subject: [PATCH] Add unit tests for pyfaust.Faust.real/imag.

---
 misc/test/src/Python/test_FaustPy.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/misc/test/src/Python/test_FaustPy.py b/misc/test/src/Python/test_FaustPy.py
index c159bcf18..33aadaf65 100644
--- a/misc/test/src/Python/test_FaustPy.py
+++ b/misc/test/src/Python/test_FaustPy.py
@@ -840,6 +840,18 @@ class TestFaustPy(unittest.TestCase):
         test_Fct[test_Fct==0] = 1
         self.assertTrue(((((test_Fct-ref_Fct)/ref_Fct) < 0.01)).all())
 
+    def test_real(self):
+        print("test Faust.real")
+        rF = self.F.real
+        rF_ref = self.mulFactors().real
+        self.assertTrue(np.allclose(rF.toarray(), rF_ref))
+
+    def test_imag(self):
+        print("test Faust.imag")
+        iF = self.F.imag
+        iF_ref = self.mulFactors().imag
+        self.assertTrue(np.allclose(iF.toarray(), iF_ref))
+
     def test_left(self):
         print("Test Faust.left()")
         for F in [self.F, self.F.T, self.F.H]:
@@ -1029,7 +1041,6 @@ class TestFaustPy(unittest.TestCase):
                                    stop_crit2)
         self.assertRaisesRegex(ValueError, err_msg, param.are_constraints_consistent, M)
 
-
 class TestFaustPyCplx(TestFaustPy):
 
         def setUp(self):
-- 
GitLab