Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_optparse.py @ 47201:9c930a32cebb
#2621 rename test.test_support to test.support
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Tue, 20 May 2008 21:35:26 +0000 |
| parents | 7dd2c1746267 |
| children | 35d73a988039 e0d45d32fb82 |
line wrap: on
line diff
--- a/Lib/test/test_optparse.py Tue May 20 07:26:11 2008 +0000 +++ b/Lib/test/test_optparse.py Tue May 20 21:35:26 2008 +0000 @@ -15,7 +15,7 @@ import unittest from io import StringIO -from test import test_support +from test import support from optparse import make_option, Option, IndentedHelpFormatter, \ @@ -1004,10 +1004,10 @@ self.parser.add_option("-f", "--file", type="file", dest="file") def tearDown(self): - if os.path.isdir(test_support.TESTFN): - os.rmdir(test_support.TESTFN) - elif os.path.isfile(test_support.TESTFN): - os.unlink(test_support.TESTFN) + if os.path.isdir(support.TESTFN): + os.rmdir(support.TESTFN) + elif os.path.isfile(support.TESTFN): + os.unlink(support.TESTFN) class MyOption (Option): def check_file(option, opt, value): @@ -1022,21 +1022,21 @@ TYPE_CHECKER["file"] = check_file def test_filetype_ok(self): - open(test_support.TESTFN, "w").close() - self.assertParseOK(["--file", test_support.TESTFN, "-afoo"], - {'file': test_support.TESTFN, 'a': 'foo'}, + open(support.TESTFN, "w").close() + self.assertParseOK(["--file", support.TESTFN, "-afoo"], + {'file': support.TESTFN, 'a': 'foo'}, []) def test_filetype_noexist(self): - self.assertParseFail(["--file", test_support.TESTFN, "-afoo"], + self.assertParseFail(["--file", support.TESTFN, "-afoo"], "%s: file does not exist" % - test_support.TESTFN) + support.TESTFN) def test_filetype_notfile(self): - os.mkdir(test_support.TESTFN) - self.assertParseFail(["--file", test_support.TESTFN, "-afoo"], + os.mkdir(support.TESTFN) + self.assertParseFail(["--file", support.TESTFN, "-afoo"], "%s: not a regular file" % - test_support.TESTFN) + support.TESTFN) class TestExtendAddActions(BaseTest): @@ -1611,7 +1611,7 @@ def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == '__main__': test_main()
