Skip to content

Commit bd65042

Browse files
committed
Add layout comments to all tests in DirCmpImplementationTests per review
1 parent 2d7d06d commit bd65042

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎Lib/test/test_filecmp.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,8 @@ def setUp(self):
437437
encoding="utf-8") as output:
438438
output.write('Different contents.\n')
439439

440+
# Test dircmp behavior when os.stat raises OSError on specific files.
441+
# Structure contains 'error_trigger_file.txt' in both directories.
440442
def test_dircmp_os_errors_in_processing(self):
441443
trigger_file = "error_trigger_file.txt"
442444
for d in (self.dir, self.dir_same):
@@ -455,6 +457,9 @@ def fake_stat(path, *args, **kwargs):
455457
dc = filecmp.dircmp(self.dir, self.dir_same)
456458
self.assertIn(trigger_file, dc.common_funny)
457459

460+
# Test common_funny layout with regular files, directories, and sockets.
461+
# 'diff_type.txt' is a directory in one path and a regular file in another.
462+
# 'funny_type.txt' simulates a socket using stat.S_IFSOCK.
458463
def test_dircmp_different_types_and_funny_types(self):
459464
file_diff_type = "diff_type.txt"
460465
file_funny_type = "funny_type.txt"
@@ -488,6 +493,9 @@ def fake_stat_types(path, *args, **kwargs):
488493
self.assertIn(file_diff_type, dc.common_funny)
489494
self.assertIn(file_funny_type, dc.common_funny)
490495

496+
# Test phase4_closure and report() output for common funny files.
497+
# Modifies os.stat for 'funny_report_file.txt' to return a socket type,
498+
# and patches filecmp._cmp to return an error status (2) for 'funny_file_trigger.txt'.
491499
def test_dircmp_closure_and_report_funnies(self):
492500
deep_dir_1 = os.path.join(self.dir, "subdir", "deep_folder")
493501
deep_dir_2 = os.path.join(self.dir_same, "subdir", "deep_folder")

0 commit comments

Comments
 (0)