Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(251706)

Side by Side Diff: Lib/test/test_unicode_file.py

Issue 16510: Using appropriate checks in tests
Patch Set: Created 5 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_types.py ('k') | Lib/test/test_uuid.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Test some Unicode file name semantics 1 # Test some Unicode file name semantics
2 # We dont test many operations on files other than 2 # We dont test many operations on files other than
3 # that their names can be used with Unicode characters. 3 # that their names can be used with Unicode characters.
4 import os, glob, time, shutil 4 import os, glob, time, shutil
5 import unicodedata 5 import unicodedata
6 6
7 import unittest 7 import unittest
8 from test.support import (run_unittest, rmtree, 8 from test.support import (run_unittest, rmtree,
9 TESTFN_ENCODING, TESTFN_UNICODE, TESTFN_UNENCODABLE, create_empty_file) 9 TESTFN_ENCODING, TESTFN_UNICODE, TESTFN_UNENCODABLE, create_empty_file)
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 # The '_test' functions 'entry points with params' - ie, what the 104 # The '_test' functions 'entry points with params' - ie, what the
105 # top-level 'test' functions would be if they could take params 105 # top-level 'test' functions would be if they could take params
106 def _test_single(self, filename): 106 def _test_single(self, filename):
107 remove_if_exists(filename) 107 remove_if_exists(filename)
108 create_empty_file(filename) 108 create_empty_file(filename)
109 try: 109 try:
110 self._do_single(filename) 110 self._do_single(filename)
111 finally: 111 finally:
112 os.unlink(filename) 112 os.unlink(filename)
113 self.assertTrue(not os.path.exists(filename)) 113 self.assertFalse(os.path.exists(filename))
114 # and again with os.open. 114 # and again with os.open.
115 f = os.open(filename, os.O_CREAT) 115 f = os.open(filename, os.O_CREAT)
116 os.close(f) 116 os.close(f)
117 try: 117 try:
118 self._do_single(filename) 118 self._do_single(filename)
119 finally: 119 finally:
120 os.unlink(filename) 120 os.unlink(filename)
121 121
122 # The 'test' functions are unittest entry points, and simply call our 122 # The 'test' functions are unittest entry points, and simply call our
123 # _test functions with each of the filename combinations we wish to test 123 # _test functions with each of the filename combinations we wish to test
(...skipping 11 matching lines...) Expand all
135 # Our directory name that can't use a non-unicode name. 135 # Our directory name that can't use a non-unicode name.
136 if TESTFN_UNENCODABLE is not None: 136 if TESTFN_UNENCODABLE is not None:
137 self._do_directory(TESTFN_UNENCODABLE+ext, 137 self._do_directory(TESTFN_UNENCODABLE+ext,
138 TESTFN_UNENCODABLE+ext) 138 TESTFN_UNENCODABLE+ext)
139 139
140 def test_main(): 140 def test_main():
141 run_unittest(__name__) 141 run_unittest(__name__)
142 142
143 if __name__ == "__main__": 143 if __name__ == "__main__":
144 test_main() 144 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_types.py ('k') | Lib/test/test_uuid.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+