]> granicus.if.org Git - python/commitdiff
Remove redundant check for symlink. (closes #6036)
authorBenjamin Peterson <benjamin@python.org>
Fri, 30 Nov 2012 21:12:15 +0000 (16:12 -0500)
committerBenjamin Peterson <benjamin@python.org>
Fri, 30 Nov 2012 21:12:15 +0000 (16:12 -0500)
Patch by Bruno Dupuis.

Lib/test/test_posixpath.py

index 957a903e3f7440e20a08b585f48aa1dd8a0cf8e5..aaf4d661ef6da3c91c6769012f0c0b5ae5e64035 100644 (file)
@@ -110,8 +110,10 @@ class PosixPathTest(unittest.TestCase):
                 ),
                 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 @@ class PosixPathTest(unittest.TestCase):
                 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()