Added support for negative indexes to PurePath.parents (GH-21799)

This commit also fixes up some of the overlapping documentation changed
in bpo-35498, which added support for indexing with slices.

Fixes bpo-21041.
https://bugs.python.org/issue21041

Co-authored-by: Paul Ganssle <p.ganssle@gmail.com>
Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index af31039..531a699 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -632,7 +632,8 @@ def __len__(self):
     def __getitem__(self, idx):
         if isinstance(idx, slice):
             return tuple(self[i] for i in range(*idx.indices(len(self))))
-        if idx < 0 or idx >= len(self):
+
+        if idx >= len(self) or idx < -len(self):
             raise IndexError(idx)
         return self._pathcls._from_parsed_parts(self._drv, self._root,
                                                 self._parts[:-idx - 1])
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py
index f145179..5e5e065 100644
--- a/Lib/test/test_pathlib.py
+++ b/Lib/test/test_pathlib.py
@@ -440,6 +440,9 @@ def test_parents_common(self):
         self.assertEqual(par[0], P('a/b'))
         self.assertEqual(par[1], P('a'))
         self.assertEqual(par[2], P('.'))
+        self.assertEqual(par[-1], P('.'))
+        self.assertEqual(par[-2], P('a'))
+        self.assertEqual(par[-3], P('a/b'))
         self.assertEqual(par[0:1], (P('a/b'),))
         self.assertEqual(par[:2], (P('a/b'), P('a')))
         self.assertEqual(par[:-1], (P('a/b'), P('a')))
@@ -448,7 +451,7 @@ def test_parents_common(self):
         self.assertEqual(par[::-1], (P('.'), P('a'), P('a/b')))
         self.assertEqual(list(par), [P('a/b'), P('a'), P('.')])
         with self.assertRaises(IndexError):
-            par[-1]
+            par[-4]
         with self.assertRaises(IndexError):
             par[3]
         with self.assertRaises(TypeError):