bpo-27200: Fix pathlib, ssl, turtle and weakref doctests (GH-616)

diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst
index 34ab3b8..1445226 100644
--- a/Doc/library/pathlib.rst
+++ b/Doc/library/pathlib.rst
@@ -271,6 +271,10 @@
 Methods and properties
 ^^^^^^^^^^^^^^^^^^^^^^
 
+.. testsetup::
+
+   from pathlib import PurePosixPath, PureWindowsPath
+
 Pure paths provide the following methods and properties:
 
 .. data:: PurePath.drive
@@ -657,6 +661,8 @@
    Return information about this path (similarly to :func:`os.stat`).
    The result is looked up at each call to this method.
 
+   ::
+
       >>> p = Path('setup.py')
       >>> p.stat().st_size
       956
@@ -948,7 +954,7 @@
 .. method:: Path.rglob(pattern)
 
    This is like calling :meth:`Path.glob` with "``**``" added in front of the
-   given *pattern*:
+   given *pattern*::
 
       >>> sorted(Path().rglob("*.py"))
       [PosixPath('build/lib/pathlib.py'),
@@ -972,6 +978,8 @@
    An :exc:`OSError` can be raised if either file cannot be accessed for some
    reason.
 
+   ::
+
       >>> p = Path('spam')
       >>> q = Path('eggs')
       >>> p.samefile(q)
@@ -988,6 +996,8 @@
    *target_is_directory* must be true (default ``False``) if the link's target
    is a directory.  Under POSIX, *target_is_directory*'s value is ignored.
 
+   ::
+
       >>> p = Path('mylink')
       >>> p.symlink_to('setup.py')
       >>> p.resolve()
diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst
index bbb1374..e394519 100644
--- a/Doc/library/ssl.rst
+++ b/Doc/library/ssl.rst
@@ -369,6 +369,10 @@
 Certificate handling
 ^^^^^^^^^^^^^^^^^^^^
 
+.. testsetup::
+
+   import ssl
+
 .. function:: match_hostname(cert, hostname)
 
    Verify that *cert* (in decoded format as returned by
@@ -415,10 +419,10 @@
 
       >>> import ssl
       >>> timestamp = ssl.cert_time_to_seconds("Jan  5 09:34:43 2018 GMT")
-      >>> timestamp
+      >>> timestamp  # doctest: +SKIP
       1515144883
       >>> from datetime import datetime
-      >>> print(datetime.utcfromtimestamp(timestamp))
+      >>> print(datetime.utcfromtimestamp(timestamp))  # doctest: +SKIP
       2018-01-05 09:34:43
 
    "notBefore" or "notAfter" dates must use GMT (:rfc:`5280`).
@@ -1378,6 +1382,7 @@
          'strength_bits': 128}]
 
    On OpenSSL 1.1 and newer the cipher dict contains additional fields::
+
        >>> ctx.get_ciphers()  # OpenSSL 1.1+
        [{'aead': True,
          'alg_bits': 256,
@@ -1638,7 +1643,7 @@
    .. versionchanged:: 3.6
       :attr:`SSLContext.options` returns :class:`Options` flags:
 
-         >>> ssl.create_default_context().options
+         >>> ssl.create_default_context().options  # doctest: +SKIP
          <Options.OP_ALL|OP_NO_SSLv3|OP_NO_SSLv2|OP_NO_COMPRESSION: 2197947391>
 
 .. attribute:: SSLContext.protocol
@@ -1658,7 +1663,7 @@
    .. versionchanged:: 3.6
       :attr:`SSLContext.verify_flags` returns :class:`VerifyFlags` flags:
 
-         >>> ssl.create_default_context().verify_flags
+         >>> ssl.create_default_context().verify_flags  # doctest: +SKIP
          <VerifyFlags.VERIFY_X509_TRUSTED_FIRST: 32768>
 
 .. attribute:: SSLContext.verify_mode
@@ -2259,6 +2264,8 @@
 :const:`PROTOCOL_TLS_SERVER` as the protocol version. SSLv2 and SSLv3 are
 disabled by default.
 
+::
+
    >>> client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
    >>> client_context.options |= ssl.OP_NO_TLSv1
    >>> client_context.options |= ssl.OP_NO_TLSv1_1
diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst
index 1986972..6f2626c 100644
--- a/Doc/library/turtle.rst
+++ b/Doc/library/turtle.rst
@@ -936,10 +936,9 @@
        >>> turtle.fillcolor("violet")
        >>> turtle.fillcolor()
        'violet'
-       >>> col = turtle.pencolor()
-       >>> col
+       >>> turtle.pencolor()
        (50.0, 193.0, 143.0)
-       >>> turtle.fillcolor(col)
+       >>> turtle.fillcolor((50, 193, 143))  # Integers, not floats
        >>> turtle.fillcolor()
        (50.0, 193.0, 143.0)
        >>> turtle.fillcolor('#ffffff')
diff --git a/Doc/library/weakref.rst b/Doc/library/weakref.rst
index b02a006..40bb06a 100644
--- a/Doc/library/weakref.rst
+++ b/Doc/library/weakref.rst
@@ -478,7 +478,7 @@
     >>> obj = Object()
     >>> f = weakref.finalize(obj, callback, 1, 2, z=3)
     >>> f.detach()                                           #doctest:+ELLIPSIS
-    (<__main__.Object object ...>, <function callback ...>, (1, 2), {'z': 3})
+    (<...Object object ...>, <function callback ...>, (1, 2), {'z': 3})
     >>> newobj, func, args, kwargs = _
     >>> assert not f.alive
     >>> assert newobj is obj