コード例 #1
0
ファイル: test_console.py プロジェクト: yuviDX/streamlink
 def test_ask_input_exception(self, isatty, input, stderr):
     isatty.return_value = True
     input.side_effect = ValueError
     self.assertEqual("", ConsoleOutput.ask("test: "))
     stderr.write.assert_called_with("test: ")
コード例 #2
0
ファイル: test_console.py プロジェクト: yuviDX/streamlink
 def test_ask_no_tty(self, isatty, input, stderr):
     isatty.return_value = False
     self.assertEqual("", ConsoleOutput.ask("test: "))
     input.assert_not_called()
     stderr.write.assert_not_called()
コード例 #3
0
ファイル: test_console.py プロジェクト: yuviDX/streamlink
 def test_ask(self, isatty, input, stderr):
     input.return_value = "hello"
     isatty.return_value = True
     self.assertEqual("hello", ConsoleOutput.ask("test: "))
     stderr.write.assert_called_with("test: ")
コード例 #4
0
 def test_ask(self):
     output = StringIO()
     console = ConsoleOutput(output)
     self.assertEqual("hello", console.ask("test: "))
     self.assertEqual("test: ", output.getvalue())
コード例 #5
0
 def test_ask_input_exception(self):
     output = StringIO()
     console = ConsoleOutput(output)
     self.assertIsNone(console.ask("test: "))
     self.assertEqual("test: ", output.getvalue())
コード例 #6
0
 def test_ask_no_tty(self, mock_input: Mock):
     output = StringIO()
     console = ConsoleOutput(output)
     self.assertIsNone(console.ask("test: "))
     self.assertEqual("", output.getvalue())
     mock_input.assert_not_called()