1+ from pathlib import Path
12from typing import Callable , Union
23from 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