

from unittest.mock import Mock, patch

from file_transfer.send_file import send_file
@patch("""socket.socket"""			)
@patch("""builtins.open"""			)
def  UpperCAmelCase__      ( UpperCAmelCase__,    UpperCAmelCase__			)     ->     Any:
       # ===== initialization =====
       A_		   = Mock()
       A_		   = conn, Mock()
       A_		   = iter([1, None]			)
       A_		   = lambda UpperCAmelCase__			: next(UpperCAmelCase__			)

       # ===== invoke =====
       send_file(filename="""mytext.txt""",    testing=UpperCAmelCase__			)

       # ===== ensurance =====
       sock.assert_called_once()
       sock.return_value.bind.assert_called_once()
       sock.return_value.listen.assert_called_once()
       sock.return_value.accept.assert_called_once()
       conn.recv.assert_called_once()

       file.return_value.__enter__.assert_called_once()
       file.return_value.__enter__.return_value.read.assert_called()

       conn.send.assert_called_once()
       conn.close.assert_called_once()
       sock.return_value.shutdown.assert_called_once()
       sock.return_value.close.assert_called_once()



'''simple docstring'''







from functools import lru_cache
@lru_cache
def  UpperCAmelCase__      ( UpperCAmelCase__			)     ->     int:
       if num < 0:
              raise ValueError("""Number should not be negative."""			)

       return 1 if num in (0, 1) else num * factorial(num - 1			)


if __name__ == "__main__":
      import doctest

      doctest.testmod()
