Skip to content

Commit f33db19

Browse files
committed
Fix import and change to f-string
1 parent 09be4ca commit f33db19

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

tests/cli/test_rasa_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from collections import namedtuple
44
from typing import Callable
55
from _pytest.pytester import RunResult
6-
from rasa.cli.data import validate_files
6+
from rasa.cli import data
77

88

99
def test_data_split_nlu(run_in_default_project: Callable[..., RunResult]):
@@ -71,7 +71,7 @@ def test_data_validate_help(run: Callable[..., RunResult]):
7171
def test_validate_files_exit_early():
7272
with pytest.raises(SystemExit) as pytest_e:
7373
args = {"domain": "data/test_domains/duplicate_intents.yml", "data": None}
74-
validate_files(namedtuple("Args", args.keys())(*args.values()))
74+
data.validate_files(namedtuple("Args", args.keys())(*args.values()))
7575

7676
assert pytest_e.type == SystemExit
7777
assert pytest_e.value.code == 1

tests/core/test_validator.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import pytest
2-
import os
32
from rasa.core.validator import Validator
43
from rasa.importers.rasa import RasaFileImporter
54
from tests.core.conftest import (
@@ -89,9 +88,8 @@ async def test_verify_logging_message_for_repetition_in_intents(caplog):
8988
)
9089

9190

92-
async def test_verify_domain_validity(caplog):
91+
async def test_early_exit_on_invalid_domain(caplog):
9392
domain_path = "data/test_domains/duplicate_intents.yml"
94-
full_path = os.path.abspath(domain_path)
9593

9694
importer = RasaFileImporter(domain_path=domain_path)
9795
validator = await Validator.from_importer(importer)
@@ -103,12 +101,9 @@ async def test_verify_domain_validity(caplog):
103101

104102
assert "WARNING" == level
105103
assert (
106-
"Loading domain from '{}' failed. Using empty domain. "
104+
f"Loading domain from '{domain_path}' failed. Using empty domain. "
107105
"Error: 'Intents are not unique! Found two intents with name "
108-
"'default'. Either rename or remove one of them.'".format(
109-
domain_path, full_path
110-
)
111-
== message
106+
"'default'. Either rename or remove one of them.'" == message
112107
)
113108

114109

0 commit comments

Comments
 (0)