m2m模型翻译
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
610 B

6 months ago
  1. import os
  2. import pytest
  3. from numpy.testing import assert_array_equal
  4. import numpy as np
  5. from . import util
  6. def _path(*a):
  7. return os.path.join(*((os.path.dirname(__file__),) + a))
  8. class TestString(util.F2PyTest):
  9. sources = [_path('src', 'string', 'char.f90')]
  10. @pytest.mark.slow
  11. def test_char(self):
  12. strings = np.array(['ab', 'cd', 'ef'], dtype='c').T
  13. inp, out = self.module.char_test.change_strings(strings, strings.shape[1])
  14. assert_array_equal(inp, strings)
  15. expected = strings.copy()
  16. expected[1, :] = 'AAA'
  17. assert_array_equal(out, expected)