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

Delta Between Two Patch Sets: Lib/test/test_stat.py

Issue 21719: Returning Windows file attribute information via os.stat()
Left Patch Set: Created 5 years, 7 months ago
Right Patch Set: Created 5 years, 7 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Lib/test/test_os.py ('k') | Modules/posixmodule.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 import unittest 1 import unittest
2 import os 2 import os
3 import sys 3 import sys
4 from test.support import TESTFN, import_fresh_module 4 from test.support import TESTFN, import_fresh_module
5 5
6 c_stat = import_fresh_module('stat', fresh=['_stat']) 6 c_stat = import_fresh_module('stat', fresh=['_stat'])
7 py_stat = import_fresh_module('stat', blocked=['_stat']) 7 py_stat = import_fresh_module('stat', blocked=['_stat'])
8 8
9 class TestFilemode: 9 class TestFilemode:
10 statmod = None 10 statmod = None
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 modvalue = getattr(self.statmod, key) 199 modvalue = getattr(self.statmod, key)
200 self.assertIsInstance(modvalue, int) 200 self.assertIsInstance(modvalue, int)
201 for key in self.formats: 201 for key in self.formats:
202 modvalue = getattr(self.statmod, key) 202 modvalue = getattr(self.statmod, key)
203 self.assertIsInstance(modvalue, int) 203 self.assertIsInstance(modvalue, int)
204 for key in self.format_funcs: 204 for key in self.format_funcs:
205 func = getattr(self.statmod, key) 205 func = getattr(self.statmod, key)
206 self.assertTrue(callable(func)) 206 self.assertTrue(callable(func))
207 self.assertEqual(func(0), 0) 207 self.assertEqual(func(0), 0)
208 208
209
210 class TestFilemodeCStat(TestFilemode, unittest.TestCase):
211 statmod = c_stat
212
213 formats = TestFilemode.formats | {'S_IFDOOR', 'S_IFPORT', 'S_IFWHT'}
214 format_funcs = TestFilemode.format_funcs | {'S_ISDOOR', 'S_ISPORT',
215 'S_ISWHT'}
216
217 @unittest.skipUnless(sys.platform == "win32", 209 @unittest.skipUnless(sys.platform == "win32",
218 "FILE_ATTRIBUTE_* constants are Win32 specific") 210 "FILE_ATTRIBUTE_* constants are Win32 specific")
219 def test_file_attribute_constants(self): 211 def test_file_attribute_constants(self):
220 for key, value in sorted(self.file_attributes.items()): 212 for key, value in sorted(self.file_attributes.items()):
221 self.assertTrue(hasattr(self.statmod, key), key) 213 self.assertTrue(hasattr(self.statmod, key), key)
222 modvalue = getattr(self.statmod, key) 214 modvalue = getattr(self.statmod, key)
223 self.assertEqual(value, modvalue, key) 215 self.assertEqual(value, modvalue, key)
224 216
225 217
218 class TestFilemodeCStat(TestFilemode, unittest.TestCase):
219 statmod = c_stat
220
221 formats = TestFilemode.formats | {'S_IFDOOR', 'S_IFPORT', 'S_IFWHT'}
222 format_funcs = TestFilemode.format_funcs | {'S_ISDOOR', 'S_ISPORT',
223 'S_ISWHT'}
224
225
226 class TestFilemodePyStat(TestFilemode, unittest.TestCase): 226 class TestFilemodePyStat(TestFilemode, unittest.TestCase):
227 statmod = py_stat 227 statmod = py_stat
228 228
229 229
230 if __name__ == '__main__': 230 if __name__ == '__main__':
231 unittest.main() 231 unittest.main()
LEFTRIGHT

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