[Python-checkins] cpython (2.7): Remove redundant check for symlink. (closes #6036)

benjamin.peterson python-checkins at python.org
Fri Nov 30 22:15:43 CET 2012


http://hg.python.org/cpython/rev/980b13df6ccd
changeset:   80664:980b13df6ccd
branch:      2.7
user:        Benjamin Peterson <benjamin at python.org>
date:        Fri Nov 30 16:12:15 2012 -0500
summary:
  Remove redundant check for symlink. (closes #6036)

Patch by Bruno Dupuis.

files:
  Lib/test/test_posixpath.py |  27 +++++++++++++------------
  1 files changed, 14 insertions(+), 13 deletions(-)


diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py
--- a/Lib/test/test_posixpath.py
+++ b/Lib/test/test_posixpath.py
@@ -110,8 +110,10 @@
                 ),
                 True
             )
-            # If we don't have links, assume that os.stat doesn't return resonable
-            # inode information and thus, that samefile() doesn't work
+
+            # If we don't have links, assume that os.stat doesn't return
+            # reasonable inode information and thus, that samefile() doesn't
+            # work.
             if hasattr(os, "symlink"):
                 os.symlink(
                     test_support.TESTFN + "1",
@@ -152,18 +154,17 @@
                 True
             )
             # If we don't have links, assume that os.stat() doesn't return resonable
-            # inode information and thus, that samefile() doesn't work
+            # inode information and thus, that samestat() doesn't work
             if hasattr(os, "symlink"):
-                if hasattr(os, "symlink"):
-                    os.symlink(test_support.TESTFN + "1", test_support.TESTFN + "2")
-                    self.assertIs(
-                        posixpath.samestat(
-                            os.stat(test_support.TESTFN + "1"),
-                            os.stat(test_support.TESTFN + "2")
-                        ),
-                        True
-                    )
-                    os.remove(test_support.TESTFN + "2")
+                os.symlink(test_support.TESTFN + "1", test_support.TESTFN + "2")
+                self.assertIs(
+                    posixpath.samestat(
+                        os.stat(test_support.TESTFN + "1"),
+                        os.stat(test_support.TESTFN + "2")
+                    ),
+                    True
+                )
+                os.remove(test_support.TESTFN + "2")
                 f = open(test_support.TESTFN + "2", "wb")
                 f.write("bar")
                 f.close()

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list