(root)/
Python-3.11.7/
Lib/
test/
test_tools/
test_reindent.py
       1  """Tests for scripts in the Tools directory.
       2  
       3  This file contains regression tests for some of the scripts found in the
       4  Tools directory of a Python checkout or tarball, such as reindent.py.
       5  """
       6  
       7  import os
       8  import unittest
       9  from test.support.script_helper import assert_python_ok
      10  from test.support import findfile
      11  
      12  from test.test_tools import scriptsdir, skip_if_missing
      13  
      14  skip_if_missing()
      15  
      16  class ESC[4;38;5;81mReindentTests(ESC[4;38;5;149munittestESC[4;38;5;149m.ESC[4;38;5;149mTestCase):
      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', subdir='tokenizedata')
      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  
      34  if __name__ == '__main__':
      35      unittest.main()