Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
2b209cd7
Kaydet (Commit)
2b209cd7
authored
Agu 15, 2012
tarafından
R David Murray
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#15269: document dircmp.left and right, and add tests for them.
Patch by Chris Jerdonek.
üst
a17ef146
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
2 deletions
+33
-2
filecmp.rst
Doc/library/filecmp.rst
+25
-0
test_filecmp.py
Lib/test/test_filecmp.py
+8
-2
No files found.
Doc/library/filecmp.rst
Dosyayı görüntüle @
2b209cd7
...
...
@@ -106,6 +106,16 @@ The :class:`dircmp` class
to compute are used.
.. attribute:: left
The directory *a*.
.. attribute:: right
The directory *b*.
.. attribute:: left_list
Files and subdirectories in *a*, filtered by *hide* and *ignore*.
...
...
@@ -169,3 +179,18 @@ The :class:`dircmp` class
A dictionary mapping names in :attr:`common_dirs` to :class:`dircmp`
objects.
Here is a simplified example of using the ``subdirs`` attribute to search
recursively through two directories to show common different files::
>>> from filecmp import dircmp
>>> def print_diff_files(dcmp):
... for name in dcmp.diff_files:
... print("diff_file %s found in %s and %s" % (name, dcmp.left,
... dcmp.right))
... for sub_dcmp in dcmp.subdirs.values():
... print_diff_files(sub_dcmp)
...
>>> dcmp = dircmp('dir1', 'dir2')
>>> print_diff_files(dcmp)
Lib/test/test_filecmp.py
Dosyayı görüntüle @
2b209cd7
...
...
@@ -98,7 +98,10 @@ class DirCompareTestCase(unittest.TestCase):
def
test_dircmp
(
self
):
# Check attributes for comparison of two identical directories
d
=
filecmp
.
dircmp
(
self
.
dir
,
self
.
dir_same
)
left_dir
,
right_dir
=
self
.
dir
,
self
.
dir_same
d
=
filecmp
.
dircmp
(
left_dir
,
right_dir
)
self
.
assertEqual
(
d
.
left
,
left_dir
)
self
.
assertEqual
(
d
.
right
,
right_dir
)
if
self
.
caseinsensitive
:
self
.
assertEqual
([
d
.
left_list
,
d
.
right_list
],[[
'file'
],
[
'FiLe'
]])
else
:
...
...
@@ -109,7 +112,10 @@ class DirCompareTestCase(unittest.TestCase):
self
.
assertEqual
(
d
.
diff_files
,
[])
# Check attributes for comparison of two different directories
d
=
filecmp
.
dircmp
(
self
.
dir
,
self
.
dir_diff
)
left_dir
,
right_dir
=
self
.
dir
,
self
.
dir_diff
d
=
filecmp
.
dircmp
(
left_dir
,
right_dir
)
self
.
assertEqual
(
d
.
left
,
left_dir
)
self
.
assertEqual
(
d
.
right
,
right_dir
)
self
.
assertEqual
(
d
.
left_list
,
[
'file'
])
self
.
assertTrue
(
d
.
right_list
==
[
'file'
,
'file2'
])
self
.
assertEqual
(
d
.
common
,
[
'file'
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment