1"""Tests for scripts in the Tools directory. 2 3This file contains regression tests for some of the scripts found in the 4Tools directory of a Python checkout or tarball, such as reindent.py. 5""" 6 7import os 8import unittest 9from test.support.script_helper import assert_python_ok 10from test.support import findfile 11 12from test.test_tools import scriptsdir, skip_if_missing 13 14skip_if_missing() 15 16class ReindentTests(unittest.TestCase): 17 script = os.path.join(scriptsdir, 'reindent.py') 18 19 def test_noargs(self): 20 assert_python_ok(self.script) 21 22 def test_help(self): 23 rc, out, err = assert_python_ok(self.script, '-h') 24 self.assertEqual(out, b'') 25 self.assertGreater(err, b'') 26 27 def test_reindent_file_with_bad_encoding(self): 28 bad_coding_path = findfile('bad_coding.py') 29 rc, out, err = assert_python_ok(self.script, '-r', bad_coding_path) 30 self.assertEqual(out, b'') 31 self.assertNotEqual(err, b'') 32 33 34if __name__ == '__main__': 35 unittest.main() 36