Skip to content

Commit

Permalink
Reset return_var's when making a new call
Browse files Browse the repository at this point in the history
This is needed to make a new ctype so we don't overwrite the old one
  • Loading branch information
rjfarmer committed Feb 29, 2024
1 parent b8497f9 commit 0776fd3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions gfort2py/fProc.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ def name(self):
return self.obj.name

def __call__(self, *args, **kwargs):
# Reset return value
self._return_value = None

self._func_args = self._convert_args(*args, **kwargs)

# print(self._func_args)
Expand Down
12 changes: 8 additions & 4 deletions tests/gh56_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
x = gf.fFort(SO, MOD)


@pytest.mark.skip("Not fixed yet")
class Testgh56Methods:
def test_gh56(self, capfd):
y1 = x.get_array(10).result
Expand All @@ -27,8 +26,13 @@ def test_gh56(self, capfd):
assert len(y1["d"]) == 10
assert len(y2["d"]) == 5

assert y1["d"] == np.array(
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0], dtype=np.float32
assert np.array_equal(
y1["d"],
np.array(
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0], dtype=np.float32
),
)

assert y2["d"] == np.array([1.0, 2.0, 3.0, 4.0, 5.0], dtype=np.float32)
assert np.array_equal(
y2["d"], np.array([1.0, 2.0, 3.0, 4.0, 5.0], dtype=np.float32)
)

0 comments on commit 0776fd3

Please sign in to comment.