/
opt
/
imh-python
/
lib
/
python3.9
/
distutils
/
tests
/
/opt/imh-python/lib/python3.9/distutils/tests
mkdir
upload
Name
Size
Mode
Actions
__pycache__/
-
0755
rm
includetest.rst
25
0644
edit
dl
rm
Setup.sample
2249
0644
edit
dl
rm
support.py
6478
0644
edit
dl
rm
test_archive_util.py
14301
0644
edit
dl
rm
test_bdist.py
1893
0644
edit
dl
rm
test_bdist_dumb.py
2905
0644
edit
dl
rm
test_bdist_msi.py
803
0644
edit
dl
rm
test_bdist_rpm.py
5008
0644
edit
dl
rm
test_bdist_wininst.py
1390
0644
edit
dl
rm
test_build.py
1965
0644
edit
dl
rm
test_build_clib.py
4631
0644
edit
dl
rm
test_build_ext.py
20633
0644
edit
dl
rm
test_build_py.py
6335
0644
edit
dl
rm
test_build_scripts.py
3593
0644
edit
dl
rm
test_check.py
5711
0644
edit
dl
rm
test_clean.py
1441
0644
edit
dl
rm
test_cmd.py
3835
0644
edit
dl
rm
test_config.py
3892
0644
edit
dl
rm
test_config_cmd.py
3023
0644
edit
dl
rm
test_core.py
4077
0644
edit
dl
rm
test_cygwinccompiler.py
5636
0644
edit
dl
rm
test_dep_util.py
2820
0644
edit
dl
rm
test_dir_util.py
4654
0644
edit
dl
rm
test_dist.py
19080
0644
edit
dl
rm
test_extension.py
2768
0644
edit
dl
rm
test_filelist.py
11475
0644
edit
dl
rm
test_file_util.py
4413
0644
edit
dl
rm
test_install.py
8612
0644
edit
dl
rm
test_install_data.py
2577
0644
edit
dl
rm
test_install_headers.py
1238
0644
edit
dl
rm
test_install_lib.py
3974
0644
edit
dl
rm
test_install_scripts.py
2625
0644
edit
dl
rm
test_log.py
1864
0644
edit
dl
rm
test_msvc9compiler.py
6038
0644
edit
dl
rm
test_msvccompiler.py
2845
0644
edit
dl
rm
test_register.py
9765
0644
edit
dl
rm
test_sdist.py
17047
0644
edit
dl
rm
test_spawn.py
5460
0644
edit
dl
rm
test_sysconfig.py
11045
0644
edit
dl
rm
test_text_file.py
3436
0644
edit
dl
rm
test_unixccompiler.py
4628
0644
edit
dl
rm
test_upload.py
7137
0644
edit
dl
rm
test_util.py
11572
0644
edit
dl
rm
test_version.py
3450
0644
edit
dl
rm
test_versionpredicate.py
280
0644
edit
dl
rm
xxmodule.c
12915
0644
edit
dl
rm
__init__.py
1344
0644
edit
dl
rm
Edit:
/opt/imh-python/lib/python3.9/distutils/tests/test_text_file.py
(3436B)
"""Tests for distutils.text_file.""" import os import unittest from distutils.text_file import TextFile from distutils.tests import support from test.support import run_unittest TEST_DATA = """# test file line 3 \\ # intervening comment continues on next line """ class TextFileTestCase(support.TempdirManager, unittest.TestCase): def test_class(self): # old tests moved from text_file.__main__ # so they are really called by the buildbots # result 1: no fancy options result1 = ['# test file\n', '\n', 'line 3 \\\n', '# intervening comment\n', ' continues on next line\n'] # result 2: just strip comments result2 = ["\n", "line 3 \\\n", " continues on next line\n"] # result 3: just strip blank lines result3 = ["# test file\n", "line 3 \\\n", "# intervening comment\n", " continues on next line\n"] # result 4: default, strip comments, blank lines, # and trailing whitespace result4 = ["line 3 \\", " continues on next line"] # result 5: strip comments and blanks, plus join lines (but don't # "collapse" joined lines result5 = ["line 3 continues on next line"] # result 6: strip comments and blanks, plus join lines (and # "collapse" joined lines result6 = ["line 3 continues on next line"] def test_input(count, description, file, expected_result): result = file.readlines() self.assertEqual(result, expected_result) tmpdir = self.mkdtemp() filename = os.path.join(tmpdir, "test.txt") out_file = open(filename, "w") try: out_file.write(TEST_DATA) finally: out_file.close() in_file = TextFile(filename, strip_comments=0, skip_blanks=0, lstrip_ws=0, rstrip_ws=0) try: test_input(1, "no processing", in_file, result1) finally: in_file.close() in_file = TextFile(filename, strip_comments=1, skip_blanks=0, lstrip_ws=0, rstrip_ws=0) try: test_input(2, "strip comments", in_file, result2) finally: in_file.close() in_file = TextFile(filename, strip_comments=0, skip_blanks=1, lstrip_ws=0, rstrip_ws=0) try: test_input(3, "strip blanks", in_file, result3) finally: in_file.close() in_file = TextFile(filename) try: test_input(4, "default processing", in_file, result4) finally: in_file.close() in_file = TextFile(filename, strip_comments=1, skip_blanks=1, join_lines=1, rstrip_ws=1) try: test_input(5, "join lines without collapsing", in_file, result5) finally: in_file.close() in_file = TextFile(filename, strip_comments=1, skip_blanks=1, join_lines=1, rstrip_ws=1, collapse_join=1) try: test_input(6, "join lines with collapsing", in_file, result6) finally: in_file.close() def test_suite(): return unittest.makeSuite(TextFileTestCase) if __name__ == "__main__": run_unittest(test_suite())
Save
cmd:
run