96
96
osutils._inaccessible_normalized_filename)
98
98
def test_platform(self):
99
# With FAT32 and certain encodings on win32
100
# a_circle_c and a_dots_c actually map to the same file
101
# adding a suffix kicks in the 'preserving but insensitive'
102
# route, and maintains the right files
103
files = [a_circle_c+'.1', a_dots_c+'.2', z_umlat_c+'.3']
100
self.build_tree([a_circle_c, a_dots_c, z_umlat_c])
105
self.build_tree(files)
101
106
except UnicodeError:
102
107
raise TestSkipped("filesystem cannot create unicode files")
104
109
if sys.platform == 'darwin':
105
expected = sorted([a_circle_d, a_dots_d, z_umlat_d])
110
expected = sorted([a_circle_d+'.1', a_dots_d+'.2', z_umlat_d+'.3'])
107
expected = sorted([a_circle_c, a_dots_c, z_umlat_c])
112
expected = sorted(files)
109
114
present = sorted(os.listdir(u'.'))
110
115
self.assertEqual(expected, present)
112
117
def test_access_normalized(self):
113
# We should always be able to access files created with normalized filenames
114
files = [a_circle_c, a_dots_c, z_umlat_c]
118
# We should always be able to access files created with
119
# normalized filenames
120
# With FAT32 and certain encodings on win32
121
# a_circle_c and a_dots_c actually map to the same file
122
# adding a suffix kicks in the 'preserving but insensitive'
123
# route, and maintains the right files
124
files = [a_circle_c+'.1', a_dots_c+'.2', z_umlat_c+'.3']
116
126
self.build_tree(files)
117
127
except UnicodeError:
126
136
self.assertTrue(can_access)
128
138
f = open(path, 'rb')
141
shouldbe = 'contents of %s%s' % (path.encode('utf8'),
146
self.assertEqual(shouldbe, actual,
147
'contents of %s is incorrect: %r != %r'
148
% (path, shouldbe, actual))
131
150
def test_access_non_normalized(self):
132
151
# Sometimes we can access non-normalized files by their normalized
133
152
# path, verify that normalized_filename returns the right info
134
files = [a_circle_d, a_dots_d, z_umlat_d]
153
files = [a_circle_d+'.1', a_dots_d+'.2', z_umlat_d+'.3']
137
156
self.build_tree(files)