From 9ad538737a7b9717c801cb9ad8bcc8aea10fc51e Mon Sep 17 00:00:00 2001 From: Christopher Albert Date: Tue, 7 Jan 2025 00:21:46 +0100 Subject: [PATCH] Fix member access with meson build --- .../issue235_allocatable_classes/Makefile | 6 +++--- examples/issue235_allocatable_classes/run.py | 20 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/issue235_allocatable_classes/Makefile b/examples/issue235_allocatable_classes/Makefile index 2e61ae90..b6d5e175 100644 --- a/examples/issue235_allocatable_classes/Makefile +++ b/examples/issue235_allocatable_classes/Makefile @@ -8,12 +8,12 @@ test: wrapper $(PYTHON) run.py wrapper: f90wrapper mytype.o myclass.o myclass_factory.o - f2py-f90wrap --build-dir . -c -m _itest --opt="-O0 -g" \ + $(PYTHON) -m f90wrap --f2py-f90wrap --build-dir . -c -m _itest --opt="-O0 -g" \ f90wrap_mytype.f90 f90wrap_myclass.f90 f90wrap_myclass_factory.f90 \ - mytype.o myclass.o myclass_factory.o + mytype.o myclass.o myclass_factory.o --lower f90wrapper: mytype.f90 myclass.f90 myclass_factory.f90 - f90wrap -m itest -P mytype.f90 myclass.f90 myclass_factory.f90 -v + $(PYTHON) -m f90wrap -m itest mytype.f90 myclass.f90 myclass_factory.f90 -v %.o : %.f90 $(FC) $(FCFLAGS) -c -g -O0 $< -o $@ diff --git a/examples/issue235_allocatable_classes/run.py b/examples/issue235_allocatable_classes/run.py index 8b60a8da..e816dc8c 100644 --- a/examples/issue235_allocatable_classes/run.py +++ b/examples/issue235_allocatable_classes/run.py @@ -9,19 +9,19 @@ class TestMyType(unittest.TestCase): def test_create_destroy_type_object(self): """Object creation and destruction should happen only once.""" - mytype.set_create_count(0) - mytype.set_destroy_count(0) + mytype.create_count = 0 + mytype.destroy_count = 0 obj = mytype.mytype_create(REF) - self.assertEqual(mytype.get_create_count(), 1) + self.assertEqual(mytype.create_count, 1) self.assertTrue(abs(obj.val - REF) < TOL) del obj - self.assertEqual(mytype.get_create_count(), 1) - self.assertGreaterEqual(mytype.get_destroy_count(), 1) + self.assertEqual(mytype.create_count, 1) + self.assertGreaterEqual(mytype.destroy_count, 1) def test_type_member_access(self): """Direct access of member variables.""" @@ -40,19 +40,19 @@ class TestMyClass(unittest.TestCase): def test_create_destroy_class_object(self): """Object creation and destruction should happen only once.""" - myclass.set_create_count(0) - myclass.set_destroy_count(0) + myclass.create_count = 0 + myclass.destroy_count = 0 obj = myclass_factory.myclass_create(REF) - self.assertEqual(myclass.get_create_count(), 1) + self.assertEqual(myclass.create_count, 1) self.assertTrue(abs(obj.get_val() - REF) < TOL) del obj - self.assertEqual(myclass.get_create_count(), 1) - self.assertGreaterEqual(myclass.get_destroy_count(), 1) + self.assertEqual(myclass.create_count, 1) + self.assertGreaterEqual(myclass.destroy_count, 1) def test_class_getter_setter(self): """Getters and setters defined in Fortran should work."""