@@ -866,9 +866,7 @@ def test_rounding_by_fmt(fmt: str, value: float, expected: float) -> None:
866866 (3600 * 24 * 365 , "a year" ),
867867 ],
868868)
869- def test_naturaldelta_context_returns_same_english (
870- seconds : int , expected : str
871- ) -> None :
869+ def test_naturaldelta_context_returns_same_english (seconds : int , expected : str ) -> None :
872870 """When no translation is active, the context parameter must not change output."""
873871 assert humanize .naturaldelta (seconds , context = "naturaltime-past" ) == expected
874872 assert humanize .naturaldelta (seconds , context = "naturaltime-future" ) == expected
@@ -878,8 +876,10 @@ def test_naturaldelta_context_calls_npgettext() -> None:
878876 """Verify that pgettext/npgettext are invoked when a context is supplied."""
879877 from unittest .mock import patch
880878
881- with patch ("humanize.time._npgettext" , wraps = time ._npgettext ) as mock_np , \
882- patch ("humanize.time._pgettext" , wraps = time ._pgettext ) as mock_p :
879+ with (
880+ patch ("humanize.time._npgettext" , wraps = time ._npgettext ) as mock_np ,
881+ patch ("humanize.time._pgettext" , wraps = time ._pgettext ) as mock_p ,
882+ ):
883883 humanize .naturaldelta (30 , context = "naturaltime-past" )
884884 # 30 seconds uses npgettext
885885 mock_np .assert_called_once_with (
@@ -904,12 +904,8 @@ def test_naturaltime_passes_context_to_naturaldelta() -> None:
904904
905905 with patch ("humanize.time._npgettext" , wraps = time ._npgettext ) as mock_np :
906906 humanize .naturaltime (past )
907- mock_np .assert_called_with (
908- "naturaltime-past" , "%d second" , "%d seconds" , 30
909- )
907+ mock_np .assert_called_with ("naturaltime-past" , "%d second" , "%d seconds" , 30 )
910908
911909 mock_np .reset_mock ()
912910 humanize .naturaltime (future )
913- mock_np .assert_called_with (
914- "naturaltime-future" , "%d second" , "%d seconds" , 30
915- )
911+ mock_np .assert_called_with ("naturaltime-future" , "%d second" , "%d seconds" , 30 )
0 commit comments