Skip to content

Commit

Permalink
Merge pull request #210 from danbeibei/optional_out_string
Browse files Browse the repository at this point in the history
Run optional_string tests from examples Makefile
  • Loading branch information
jameskermode authored Mar 7, 2024
2 parents e960cc5 + cbc5763 commit 6297818
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ EXAMPLES = arrayderivedtypes \
type_bn \
docstring \
type_check \
derivedtypes_procedure
derivedtypes_procedure \
optional_string

PYTHON = python

Expand Down
6 changes: 3 additions & 3 deletions examples/optional_string/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ def test_string_in_3(self):
m_string_test.string_in(np.string_('yo'))

def test_string_to_string(self):
in_string = b'yo'
in_string = 'yo'
out_string = m_string_test.string_to_string(in_string)
self.assertEqual(in_string, out_string)
self.assertEqual(in_string, out_string.decode("utf-8").strip())

@unittest.skipIf(version.parse(np.version.version) < version.parse("1.24.0") , "This test is known to fail on numpy version older than 1.24.0")
def test_string_to_string_array(self):
Expand All @@ -30,7 +30,7 @@ def test_string_to_string_array(self):

def test_string_out(self):
out_string = m_string_test.string_out()
self.assertEqual(out_string, b"output string")
self.assertEqual(out_string.decode("utf-8").strip(), "output string")

@unittest.skipIf(version.parse(np.version.version) < version.parse("1.23.5") , "This test is known to fail on numpy version older than 1.23.5")
def test_string_out_optional(self):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description = "Fortran to Python interface generator with derived type support"
authors = [{name = "James Kermode", email = "james.kermode@gmail.com"}]
python-requires = ">=3.6"
urls = {Homepage = "https://github.com/jameskermode/f90wrap"}
dependencies = ["numpy>=1.13"]
dependencies = ["numpy>=1.13", "packaging"]
dynamic = ["version"]

[project.readme]
Expand Down

0 comments on commit 6297818

Please sign in to comment.