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

Delta Between Two Patch Sets: Lib/test/test_os.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/stat.py ('k') | Lib/test/test_stat.py » ('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 # As a test suite for the os module, this is woefully inadequate, but this 1 # As a test suite for the os module, this is woefully inadequate, but this
2 # does add tests for a few functions which have been determined to be more 2 # does add tests for a few functions which have been determined to be more
3 # portable than they had been thought to be. 3 # portable than they had been thought to be.
4 4
5 import os 5 import os
6 import errno 6 import errno
7 import unittest 7 import unittest
8 import warnings 8 import warnings
9 import sys 9 import sys
10 import signal 10 import signal
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 self.assertTrue(hasattr(result, 'st_file_attributes')) 534 self.assertTrue(hasattr(result, 'st_file_attributes'))
535 self.assertTrue(isinstance(result.st_file_attributes, int)) 535 self.assertTrue(isinstance(result.st_file_attributes, int))
536 self.assertTrue(0 <= result.st_file_attributes <= 0xFFFFFFFF) 536 self.assertTrue(0 <= result.st_file_attributes <= 0xFFFFFFFF)
537 537
538 @unittest.skipUnless(sys.platform == "win32", 538 @unittest.skipUnless(sys.platform == "win32",
539 "st_file_attributes is Win32 specific") 539 "st_file_attributes is Win32 specific")
540 def test_file_attributes(self): 540 def test_file_attributes(self):
541 # test st_file_attributes on a file (FILE_ATTRIBUTE_DIRECTORY not set) 541 # test st_file_attributes on a file (FILE_ATTRIBUTE_DIRECTORY not set)
542 result = os.stat(self.fname) 542 result = os.stat(self.fname)
543 self.check_file_attributes(result) 543 self.check_file_attributes(result)
544 self.assertTrue(result.st_file_attributes & 0x10 == 0) 544 self.assertEqual(result.st_file_attributes & stat.FILE_ATTRIBUTE_DIRECTO RY, 0)
545 545
546 # test st_file_attributes on a directory (FILE_ATTRIBUTE_DIRECTORY) 546 # test st_file_attributes on a directory (FILE_ATTRIBUTE_DIRECTORY set)
547 result = os.stat(support.TESTFN) 547 result = os.stat(support.TESTFN)
548 self.check_file_attributes(result) 548 self.check_file_attributes(result)
549 self.assertTrue(result.st_file_attributes & 0x10 == 0x10) 549 self.assertEqual(result.st_file_attributes & stat.FILE_ATTRIBUTE_DIRECTO RY,
550 stat.FILE_ATTRIBUTE_DIRECTORY)
550 551
551 from test import mapping_tests 552 from test import mapping_tests
552 553
553 class EnvironTests(mapping_tests.BasicTestMappingProtocol): 554 class EnvironTests(mapping_tests.BasicTestMappingProtocol):
554 """check that os.environ object conform to mapping protocol""" 555 """check that os.environ object conform to mapping protocol"""
555 type2test = None 556 type2test = None
556 557
557 def setUp(self): 558 def setUp(self):
558 self.__save = dict(os.environ) 559 self.__save = dict(os.environ)
559 if os.supports_bytes_environ: 560 if os.supports_bytes_environ:
(...skipping 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after
2595 TermsizeTests, 2596 TermsizeTests,
2596 OSErrorTests, 2597 OSErrorTests,
2597 RemoveDirsTests, 2598 RemoveDirsTests,
2598 CPUCountTests, 2599 CPUCountTests,
2599 FDInheritanceTests, 2600 FDInheritanceTests,
2600 Win32JunctionTests, 2601 Win32JunctionTests,
2601 ) 2602 )
2602 2603
2603 if __name__ == "__main__": 2604 if __name__ == "__main__":
2604 test_main() 2605 test_main()
LEFTRIGHT

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