def test_print_version(self):
        sys_stdout = sys.stdout
        sys.stdout = io.StringIO() if UnicodeType == str else io.BytesIO()

        self.assertEqual(print_version(False), None)
        self.assertEqual(sys.stdout.getvalue(), '')

        with self.assertRaises(SystemExit):
            self.assertEqual(print_version(True), None)
        self.assertEqual(sys.stdout.getvalue(), __version__ + '\n')

        sys.stdout = sys_stdout
Ejemplo n.º 2
0
 def test_print_version(self):
     self.assertNotEqual(print_version(False), 2, msg=__version__)
     with self.assertRaises(SystemExit):
         self.assertEqual(print_version(True), 2, msg=__version__)
Ejemplo n.º 3
0
 def test_print_version(self):
     self.assertNotEqual(print_version(False), 2, msg=__version__)
     with self.assertRaises(SystemExit):
         self.assertEqual(print_version(True), 2, msg=__version__)