Browse Source

修正部分测试用例

tags/v1.0.0alpha
x54-729 2 years ago
parent
commit
51a3e901f0
3 changed files with 4 additions and 3 deletions
  1. +1
    -2
      tests/core/collators/padders/test_raw_padder.py
  2. +1
    -0
      tests/core/utils/test_cache_results.py
  3. +2
    -1
      tests/envs/test_set_backend.py

+ 1
- 2
tests/core/collators/padders/test_raw_padder.py View File

@@ -23,7 +23,6 @@ class TestRawSequencePadder:
assert (a == b).sum().item() == shape[0]*shape[1]

def test_dtype_check(self):
with pytest.raises(DtypeError):
padder = RawSequencePadder(pad_val=-1, ele_dtype=np.zeros(3, dtype=np.int8).dtype, dtype=int)
padder = RawSequencePadder(pad_val=-1, ele_dtype=np.zeros(3, dtype=np.int8).dtype, dtype=int)
with pytest.raises(DtypeError):
padder = RawSequencePadder(pad_val=-1, ele_dtype=str, dtype=int)

+ 1
- 0
tests/core/utils/test_cache_results.py View File

@@ -3,6 +3,7 @@ import pytest
import subprocess
from io import StringIO
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../../..'))

from fastNLP.core.utils.cache_results import cache_results
from fastNLP.core import rank_zero_rm


+ 2
- 1
tests/envs/test_set_backend.py View File

@@ -1,4 +1,5 @@
import os
import pytest

from fastNLP.envs.set_backend import dump_fastnlp_backend
from tests.helpers.utils import Capturing
@@ -9,7 +10,7 @@ def test_dump_fastnlp_envs():
filepath = None
try:
with Capturing() as output:
dump_fastnlp_backend()
dump_fastnlp_backend(backend="torch")
filepath = os.path.join(os.path.expanduser('~'), '.fastNLP', 'envs', os.environ['CONDA_DEFAULT_ENV']+'.json')
assert filepath in output[0]
assert os.path.exists(filepath)


Loading…
Cancel
Save