Skip to content

Commit 0f6a9b5

Browse files
perrygoybandophahita
authored andcommitted
add test for Path attachments.
1 parent 413b600 commit 0f6a9b5

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

tests/test_narrator.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from pathlib import Path
12
from typing import Callable, Union
23
from unittest import mock
34

@@ -277,7 +278,7 @@ def test_channels(self, channel_func: str, channel: str) -> None:
277278
assert narrate.call_args_list[0][0][0] == channel
278279
assert list(narrate.call_args_list[0][1].keys()) == expected_kwargs
279280

280-
def test_attach(self) -> None:
281+
def test_attach_strfilepath(self) -> None:
281282
test_adapters = [get_mock_adapter() for _ in range(3)]
282283
narrator = Narrator(adapters=test_adapters) # type: ignore[arg-type] # good ol' mocks
283284
test_path = "lskywalker/documents/father.png"
@@ -288,6 +289,17 @@ def test_attach(self) -> None:
288289
for mocked_adapter in test_adapters:
289290
mocked_adapter.attach.assert_called_once_with(test_path, **test_kwargs)
290291

292+
def test_attach_pathfilepath(self) -> None:
293+
test_adapters = [get_mock_adapter() for _ in range(3)]
294+
narrator = Narrator(adapters=test_adapters) # type: ignore[arg-type] # good ol' mocks
295+
test_path = Path("/lskywalker/documents/father.png")
296+
test_kwargs = {"no": "that's not true!", "that": "is impossible!"}
297+
298+
narrator.attaches_a_file(test_path, **test_kwargs)
299+
300+
for mocked_adapter in test_adapters:
301+
mocked_adapter.attach.assert_called_once_with(test_path, **test_kwargs)
302+
291303
def test_off_the_air_goes_back_on_after_error(self) -> None:
292304
narrator = Narrator(adapters=[get_mock_adapter()])
293305

0 commit comments

Comments
 (0)