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)
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)
def test_number(self): roller.main() self.assertEqual(self.stdout.getvalue().strip(), '5 5 5')
def test_basic(self): roller.main() self.assertEqual(self.stdout.getvalue().strip(), '5')
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)
def test_wrap_off(self): roller.main() output = self.stdout.getvalue().strip() self.assertEqual(len(output), 999)
def test_wrap(self): roller.main() lines = self.stdout.getvalue().split('\n') self.assertLessEqual(max(len(line) for line in lines), 80)