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

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

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 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_ttk_guionly.py ('k') | Lib/test/test_unicode.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)
10 10
11 if not os.path.supports_unicode_filenames: 11 if not os.path.supports_unicode_filenames:
12 try: 12 try:
13 TESTFN_UNICODE.encode(TESTFN_ENCODING) 13 TESTFN_UNICODE.encode(TESTFN_ENCODING)
14 except (UnicodeError, TypeError): 14 except (UnicodeError, TypeError):
15 # Either the file system encoding is None, or the file name 15 # Either the file system encoding is None, or the file name
16 # cannot be encoded in the file system encoding. 16 # cannot be encoded in the file system encoding.
17 raise unittest.SkipTest("No Unicode filesystem semantics on this platfor m.") 17 raise unittest.SkipTest("No Unicode filesystem semantics on this platfor m.")
18 18
19 def remove_if_exists(filename): 19 def remove_if_exists(filename):
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 self.assertEqual(os.path.basename(cwd_result),name_result) 92 self.assertEqual(os.path.basename(cwd_result),name_result)
93 finally: 93 finally:
94 os.chdir(cwd) 94 os.chdir(cwd)
95 finally: 95 finally:
96 os.rmdir(make_name) 96 os.rmdir(make_name)
97 97
98 # The '_test' functions 'entry points with params' - ie, what the 98 # The '_test' functions 'entry points with params' - ie, what the
99 # top-level 'test' functions would be if they could take params 99 # top-level 'test' functions would be if they could take params
100 def _test_single(self, filename): 100 def _test_single(self, filename):
101 remove_if_exists(filename) 101 remove_if_exists(filename)
102 create_empty_file(filename) 102 f = open(filename, "w")
103 f.close()
103 try: 104 try:
104 self._do_single(filename) 105 self._do_single(filename)
105 finally: 106 finally:
106 os.unlink(filename) 107 os.unlink(filename)
107 self.assertTrue(not os.path.exists(filename)) 108 self.assertTrue(not os.path.exists(filename))
108 # and again with os.open. 109 # and again with os.open.
109 f = os.open(filename, os.O_CREAT) 110 f = os.open(filename, os.O_CREAT)
110 os.close(f) 111 os.close(f)
111 try: 112 try:
112 self._do_single(filename) 113 self._do_single(filename)
(...skipping 16 matching lines...) Expand all
129 # Our directory name that can't use a non-unicode name. 130 # Our directory name that can't use a non-unicode name.
130 if TESTFN_UNENCODABLE is not None: 131 if TESTFN_UNENCODABLE is not None:
131 self._do_directory(TESTFN_UNENCODABLE+ext, 132 self._do_directory(TESTFN_UNENCODABLE+ext,
132 TESTFN_UNENCODABLE+ext) 133 TESTFN_UNENCODABLE+ext)
133 134
134 def test_main(): 135 def test_main():
135 run_unittest(__name__) 136 run_unittest(__name__)
136 137
137 if __name__ == "__main__": 138 if __name__ == "__main__":
138 test_main() 139 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_ttk_guionly.py ('k') | Lib/test/test_unicode.py » ('j') | no next file with comments »

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