Пример #1
0
 def test_critical(self, basic: Mock, parse: Mock):
     basic.return_value = 5
     parse.return_value = base_args(critical=True)
     roller.main()
     basic.assert_called_with(sentinel, roller.Mode.CRIT)
     parse.return_value = base_args(critical=True, average=True)
     roller.main()
     basic.assert_called_with(sentinel, roller.Mode.CRIT)
Пример #2
0
 def test_average(self, basic: Mock):
     basic.return_value = 5
     roller.main()
     self.assertEqual(self.stdout.getvalue().strip(), '5')
     basic.assert_called_with(sentinel, roller.Mode.AVERAGE)
Пример #3
0
 def test_number(self):
     roller.main()
     self.assertEqual(self.stdout.getvalue().strip(), '5 5 5')
Пример #4
0
 def test_basic(self):
     roller.main()
     self.assertEqual(self.stdout.getvalue().strip(), '5')
Пример #5
0
 def test_verbose(self, verbose):
     verbose.return_value = '5 = 5'
     roller.main()
     self.assertEqual(self.stdout.getvalue().strip(), '5 = 5')
     verbose.assert_called_with(sentinel, roller.Mode.NORMAL)
Пример #6
0
 def test_wrap_off(self):
     roller.main()
     output = self.stdout.getvalue().strip()
     self.assertEqual(len(output), 999)
Пример #7
0
 def test_wrap(self):
     roller.main()
     lines = self.stdout.getvalue().split('\n')
     self.assertLessEqual(max(len(line) for line in lines), 80)