Current File : /home/mmdealscpanel/yummmdeals.com/test.tar
test_support.pyo000064400000000401150327172240010046 0ustar00�
zfc@s,ddlZddlZejejd<dS(i����Nstest.test_support(tsysttest.supportttesttsupporttmodules(((s)/usr/lib64/python2.7/test/test_support.pyt<module>s__init__.py000064400000000057150327172240006662 0ustar00# Dummy file to make this directory a package.
test_support.py000064400000000117150327172240007673 0ustar00import sys
import test.support
sys.modules['test.test_support'] = test.support
__init__.pyo000064400000000174150327172240007041 0ustar00�
zfc@sdS(N((((s%/usr/lib64/python2.7/test/__init__.pyt<module>tscript_helper.pyc000064400000000272150327172240010130 0ustar00�
zfc@sddlTdS(i����(t*N(ttest.support.script_helper(((s*/usr/lib64/python2.7/test/script_helper.pyt<module>tscript_helper.py000064400000000051150327172240007760 0ustar00from test.support.script_helper import *
support/__init__.py000064400000227217150327172240010407 0ustar00"""Supporting definitions for the Python regression tests."""

if __name__ != 'test.support':
    raise ImportError('test.support must be imported from the test package')

import contextlib
import errno
import fnmatch
import functools
import gc
import socket
import stat
import sys
import os
import platform
import shutil
import warnings
import unittest
import importlib
import UserDict
import re
import time
import struct
import sysconfig
import types

try:
    import thread
except ImportError:
    thread = None

__all__ = ["Error", "TestFailed", "TestDidNotRun", "ResourceDenied", "import_module",
           "verbose", "use_resources", "max_memuse", "record_original_stdout",
           "get_original_stdout", "unload", "unlink", "rmtree", "forget",
           "is_resource_enabled", "requires", "requires_mac_ver",
           "find_unused_port", "bind_port",
           "fcmp", "have_unicode", "is_jython", "TESTFN", "HOST", "FUZZ",
           "SAVEDCWD", "temp_cwd", "findfile", "sortdict", "check_syntax_error",
           "open_urlresource", "check_warnings", "check_py3k_warnings",
           "CleanImport", "EnvironmentVarGuard", "captured_output",
           "captured_stdout", "TransientResource", "transient_internet",
           "run_with_locale", "set_memlimit", "bigmemtest", "bigaddrspacetest",
           "BasicTestRunner", "run_unittest", "run_doctest", "threading_setup",
           "threading_cleanup", "reap_threads", "start_threads", "cpython_only",
           "check_impl_detail", "get_attribute", "py3k_bytes",
           "import_fresh_module", "threading_cleanup", "reap_children",
           "strip_python_stderr", "IPV6_ENABLED", "run_with_tz",
           "SuppressCrashReport"]

SHORT_TIMEOUT = 30.0  # Added to make backporting from 3.x easier

class Error(Exception):
    """Base class for regression test exceptions."""

class TestFailed(Error):
    """Test failed."""

class TestDidNotRun(Error):
    """Test did not run any subtests."""

class ResourceDenied(unittest.SkipTest):
    """Test skipped because it requested a disallowed resource.

    This is raised when a test calls requires() for a resource that
    has not been enabled.  It is used to distinguish between expected
    and unexpected skips.
    """

@contextlib.contextmanager
def _ignore_deprecated_imports(ignore=True):
    """Context manager to suppress package and module deprecation
    warnings when importing them.

    If ignore is False, this context manager has no effect."""
    if ignore:
        with warnings.catch_warnings():
            warnings.filterwarnings("ignore", ".+ (module|package)",
                                    DeprecationWarning)
            yield
    else:
        yield


def import_module(name, deprecated=False):
    """Import and return the module to be tested, raising SkipTest if
    it is not available.

    If deprecated is True, any module or package deprecation messages
    will be suppressed."""
    with _ignore_deprecated_imports(deprecated):
        try:
            return importlib.import_module(name)
        except ImportError, msg:
            raise unittest.SkipTest(str(msg))


def _save_and_remove_module(name, orig_modules):
    """Helper function to save and remove a module from sys.modules

       Raise ImportError if the module can't be imported."""
    # try to import the module and raise an error if it can't be imported
    if name not in sys.modules:
        __import__(name)
        del sys.modules[name]
    for modname in list(sys.modules):
        if modname == name or modname.startswith(name + '.'):
            orig_modules[modname] = sys.modules[modname]
            del sys.modules[modname]

def _save_and_block_module(name, orig_modules):
    """Helper function to save and block a module in sys.modules

       Return True if the module was in sys.modules, False otherwise."""
    saved = True
    try:
        orig_modules[name] = sys.modules[name]
    except KeyError:
        saved = False
    sys.modules[name] = None
    return saved


def import_fresh_module(name, fresh=(), blocked=(), deprecated=False):
    """Imports and returns a module, deliberately bypassing the sys.modules cache
    and importing a fresh copy of the module. Once the import is complete,
    the sys.modules cache is restored to its original state.

    Modules named in fresh are also imported anew if needed by the import.
    If one of these modules can't be imported, None is returned.

    Importing of modules named in blocked is prevented while the fresh import
    takes place.

    If deprecated is True, any module or package deprecation messages
    will be suppressed."""
    # NOTE: test_heapq, test_json, and test_warnings include extra sanity
    # checks to make sure that this utility function is working as expected
    with _ignore_deprecated_imports(deprecated):
        # Keep track of modules saved for later restoration as well
        # as those which just need a blocking entry removed
        orig_modules = {}
        names_to_remove = []
        _save_and_remove_module(name, orig_modules)
        try:
            for fresh_name in fresh:
                _save_and_remove_module(fresh_name, orig_modules)
            for blocked_name in blocked:
                if not _save_and_block_module(blocked_name, orig_modules):
                    names_to_remove.append(blocked_name)
            fresh_module = importlib.import_module(name)
        except ImportError:
            fresh_module = None
        finally:
            for orig_name, module in orig_modules.items():
                sys.modules[orig_name] = module
            for name_to_remove in names_to_remove:
                del sys.modules[name_to_remove]
        return fresh_module


def get_attribute(obj, name):
    """Get an attribute, raising SkipTest if AttributeError is raised."""
    try:
        attribute = getattr(obj, name)
    except AttributeError:
        if isinstance(obj, types.ModuleType):
            msg = "module %r has no attribute %r" % (obj.__name__, name)
        elif isinstance(obj, types.ClassType):
            msg = "class %s has no attribute %r" % (obj.__name__, name)
        elif isinstance(obj, types.InstanceType):
            msg = "%s instance has no attribute %r" % (obj.__class__.__name__, name)
        elif isinstance(obj, type):
            msg = "type object %r has no attribute %r" % (obj.__name__, name)
        else:
            msg = "%r object has no attribute %r" % (type(obj).__name__, name)
        raise unittest.SkipTest(msg)
    else:
        return attribute


verbose = 1              # Flag set to 0 by regrtest.py
use_resources = None     # Flag set to [] by regrtest.py
max_memuse = 0           # Disable bigmem tests (they will still be run with
                         # small sizes, to make sure they work.)
real_max_memuse = 0
failfast = False

# _original_stdout is meant to hold stdout at the time regrtest began.
# This may be "the real" stdout, or IDLE's emulation of stdout, or whatever.
# The point is to have some flavor of stdout the user can actually see.
_original_stdout = None
def record_original_stdout(stdout):
    global _original_stdout
    _original_stdout = stdout

def get_original_stdout():
    return _original_stdout or sys.stdout

def unload(name):
    try:
        del sys.modules[name]
    except KeyError:
        pass

def _force_run(path, func, *args):
    try:
        return func(*args)
    except EnvironmentError as err:
        if verbose >= 2:
            print('%s: %s' % (err.__class__.__name__, err))
            print('re-run %s%r' % (func.__name__, args))
        os.chmod(path, stat.S_IRWXU)
        return func(*args)

if sys.platform.startswith("win"):
    def _waitfor(func, pathname, waitall=False):
        # Perform the operation
        func(pathname)
        # Now setup the wait loop
        if waitall:
            dirname = pathname
        else:
            dirname, name = os.path.split(pathname)
            dirname = dirname or '.'
        # Check for `pathname` to be removed from the filesystem.
        # The exponential backoff of the timeout amounts to a total
        # of ~1 second after which the deletion is probably an error
        # anyway.
        # Testing on an i7@4.3GHz shows that usually only 1 iteration is
        # required when contention occurs.
        timeout = 0.001
        while timeout < 1.0:
            # Note we are only testing for the existence of the file(s) in
            # the contents of the directory regardless of any security or
            # access rights.  If we have made it this far, we have sufficient
            # permissions to do that much using Python's equivalent of the
            # Windows API FindFirstFile.
            # Other Windows APIs can fail or give incorrect results when
            # dealing with files that are pending deletion.
            L = os.listdir(dirname)
            if not (L if waitall else name in L):
                return
            # Increase the timeout and try again
            time.sleep(timeout)
            timeout *= 2
        warnings.warn('tests may fail, delete still pending for ' + pathname,
                      RuntimeWarning, stacklevel=4)

    def _unlink(filename):
        _waitfor(os.unlink, filename)

    def _rmdir(dirname):
        _waitfor(os.rmdir, dirname)

    def _rmtree(path):
        def _rmtree_inner(path):
            for name in _force_run(path, os.listdir, path):
                fullname = os.path.join(path, name)
                if os.path.isdir(fullname):
                    _waitfor(_rmtree_inner, fullname, waitall=True)
                    _force_run(fullname, os.rmdir, fullname)
                else:
                    _force_run(fullname, os.unlink, fullname)
        _waitfor(_rmtree_inner, path, waitall=True)
        _waitfor(lambda p: _force_run(p, os.rmdir, p), path)
else:
    _unlink = os.unlink
    _rmdir = os.rmdir

    def _rmtree(path):
        try:
            shutil.rmtree(path)
            return
        except EnvironmentError:
            pass

        def _rmtree_inner(path):
            for name in _force_run(path, os.listdir, path):
                fullname = os.path.join(path, name)
                try:
                    mode = os.lstat(fullname).st_mode
                except EnvironmentError:
                    mode = 0
                if stat.S_ISDIR(mode):
                    _rmtree_inner(fullname)
                    _force_run(path, os.rmdir, fullname)
                else:
                    _force_run(path, os.unlink, fullname)
        _rmtree_inner(path)
        os.rmdir(path)

def unlink(filename):
    try:
        _unlink(filename)
    except OSError as exc:
        if exc.errno not in (errno.ENOENT, errno.ENOTDIR):
            raise

def rmdir(dirname):
    try:
        _rmdir(dirname)
    except OSError as error:
        # The directory need not exist.
        if error.errno != errno.ENOENT:
            raise

def rmtree(path):
    try:
        _rmtree(path)
    except OSError, e:
        # Unix returns ENOENT, Windows returns ESRCH.
        if e.errno not in (errno.ENOENT, errno.ESRCH):
            raise

def forget(modname):
    '''"Forget" a module was ever imported by removing it from sys.modules and
    deleting any .pyc and .pyo files.'''
    unload(modname)
    for dirname in sys.path:
        unlink(os.path.join(dirname, modname + os.extsep + 'pyc'))
        # Deleting the .pyo file cannot be within the 'try' for the .pyc since
        # the chance exists that there is no .pyc (and thus the 'try' statement
        # is exited) but there is a .pyo file.
        unlink(os.path.join(dirname, modname + os.extsep + 'pyo'))

# Check whether a gui is actually available
def _is_gui_available():
    if hasattr(_is_gui_available, 'result'):
        return _is_gui_available.result
    reason = None
    if sys.platform.startswith('win'):
        # if Python is running as a service (such as the buildbot service),
        # gui interaction may be disallowed
        import ctypes
        import ctypes.wintypes
        UOI_FLAGS = 1
        WSF_VISIBLE = 0x0001
        class USEROBJECTFLAGS(ctypes.Structure):
            _fields_ = [("fInherit", ctypes.wintypes.BOOL),
                        ("fReserved", ctypes.wintypes.BOOL),
                        ("dwFlags", ctypes.wintypes.DWORD)]
        dll = ctypes.windll.user32
        h = dll.GetProcessWindowStation()
        if not h:
            raise ctypes.WinError()
        uof = USEROBJECTFLAGS()
        needed = ctypes.wintypes.DWORD()
        res = dll.GetUserObjectInformationW(h,
            UOI_FLAGS,
            ctypes.byref(uof),
            ctypes.sizeof(uof),
            ctypes.byref(needed))
        if not res:
            raise ctypes.WinError()
        if not bool(uof.dwFlags & WSF_VISIBLE):
            reason = "gui not available (WSF_VISIBLE flag not set)"
    elif sys.platform == 'darwin':
        # The Aqua Tk implementations on OS X can abort the process if
        # being called in an environment where a window server connection
        # cannot be made, for instance when invoked by a buildbot or ssh
        # process not running under the same user id as the current console
        # user.  To avoid that, raise an exception if the window manager
        # connection is not available.
        from ctypes import cdll, c_int, pointer, Structure
        from ctypes.util import find_library

        app_services = cdll.LoadLibrary(find_library("ApplicationServices"))

        if app_services.CGMainDisplayID() == 0:
            reason = "gui tests cannot run without OS X window manager"
        else:
            class ProcessSerialNumber(Structure):
                _fields_ = [("highLongOfPSN", c_int),
                            ("lowLongOfPSN", c_int)]
            psn = ProcessSerialNumber()
            psn_p = pointer(psn)
            if (  (app_services.GetCurrentProcess(psn_p) < 0) or
                  (app_services.SetFrontProcess(psn_p) < 0) ):
                reason = "cannot run without OS X gui process"

    # check on every platform whether tkinter can actually do anything
    if not reason:
        try:
            from Tkinter import Tk
            root = Tk()
            root.withdraw()
            root.update()
            root.destroy()
        except Exception as e:
            err_string = str(e)
            if len(err_string) > 50:
                err_string = err_string[:50] + ' [...]'
            reason = 'Tk unavailable due to {}: {}'.format(type(e).__name__,
                                                           err_string)

    _is_gui_available.reason = reason
    _is_gui_available.result = not reason

    return _is_gui_available.result

def is_resource_enabled(resource):
    """Test whether a resource is enabled.

    Known resources are set by regrtest.py.  If not running under regrtest.py,
    all resources are assumed enabled unless use_resources has been set.
    """
    return use_resources is None or resource in use_resources

def requires(resource, msg=None):
    """Raise ResourceDenied if the specified resource is not available."""
    if not is_resource_enabled(resource):
        if msg is None:
            msg = "Use of the `%s' resource not enabled" % resource
        raise ResourceDenied(msg)
    if resource == 'gui' and not _is_gui_available():
        raise ResourceDenied(_is_gui_available.reason)

def requires_mac_ver(*min_version):
    """Decorator raising SkipTest if the OS is Mac OS X and the OS X
    version if less than min_version.

    For example, @requires_mac_ver(10, 5) raises SkipTest if the OS X version
    is lesser than 10.5.
    """
    def decorator(func):
        @functools.wraps(func)
        def wrapper(*args, **kw):
            if sys.platform == 'darwin':
                version_txt = platform.mac_ver()[0]
                try:
                    version = tuple(map(int, version_txt.split('.')))
                except ValueError:
                    pass
                else:
                    if version < min_version:
                        min_version_txt = '.'.join(map(str, min_version))
                        raise unittest.SkipTest(
                            "Mac OS X %s or higher required, not %s"
                            % (min_version_txt, version_txt))
            return func(*args, **kw)
        wrapper.min_version = min_version
        return wrapper
    return decorator


# Don't use "localhost", since resolving it uses the DNS under recent
# Windows versions (see issue #18792).
HOST = "127.0.0.1"
HOSTv6 = "::1"


def find_unused_port(family=socket.AF_INET, socktype=socket.SOCK_STREAM):
    """Returns an unused port that should be suitable for binding.  This is
    achieved by creating a temporary socket with the same family and type as
    the 'sock' parameter (default is AF_INET, SOCK_STREAM), and binding it to
    the specified host address (defaults to 0.0.0.0) with the port set to 0,
    eliciting an unused ephemeral port from the OS.  The temporary socket is
    then closed and deleted, and the ephemeral port is returned.

    Either this method or bind_port() should be used for any tests where a
    server socket needs to be bound to a particular port for the duration of
    the test.  Which one to use depends on whether the calling code is creating
    a python socket, or if an unused port needs to be provided in a constructor
    or passed to an external program (i.e. the -accept argument to openssl's
    s_server mode).  Always prefer bind_port() over find_unused_port() where
    possible.  Hard coded ports should *NEVER* be used.  As soon as a server
    socket is bound to a hard coded port, the ability to run multiple instances
    of the test simultaneously on the same host is compromised, which makes the
    test a ticking time bomb in a buildbot environment. On Unix buildbots, this
    may simply manifest as a failed test, which can be recovered from without
    intervention in most cases, but on Windows, the entire python process can
    completely and utterly wedge, requiring someone to log in to the buildbot
    and manually kill the affected process.

    (This is easy to reproduce on Windows, unfortunately, and can be traced to
    the SO_REUSEADDR socket option having different semantics on Windows versus
    Unix/Linux.  On Unix, you can't have two AF_INET SOCK_STREAM sockets bind,
    listen and then accept connections on identical host/ports.  An EADDRINUSE
    socket.error will be raised at some point (depending on the platform and
    the order bind and listen were called on each socket).

    However, on Windows, if SO_REUSEADDR is set on the sockets, no EADDRINUSE
    will ever be raised when attempting to bind two identical host/ports. When
    accept() is called on each socket, the second caller's process will steal
    the port from the first caller, leaving them both in an awkwardly wedged
    state where they'll no longer respond to any signals or graceful kills, and
    must be forcibly killed via OpenProcess()/TerminateProcess().

    The solution on Windows is to use the SO_EXCLUSIVEADDRUSE socket option
    instead of SO_REUSEADDR, which effectively affords the same semantics as
    SO_REUSEADDR on Unix.  Given the propensity of Unix developers in the Open
    Source world compared to Windows ones, this is a common mistake.  A quick
    look over OpenSSL's 0.9.8g source shows that they use SO_REUSEADDR when
    openssl.exe is called with the 's_server' option, for example. See
    http://bugs.python.org/issue2550 for more info.  The following site also
    has a very thorough description about the implications of both REUSEADDR
    and EXCLUSIVEADDRUSE on Windows:
    http://msdn2.microsoft.com/en-us/library/ms740621(VS.85).aspx)

    XXX: although this approach is a vast improvement on previous attempts to
    elicit unused ports, it rests heavily on the assumption that the ephemeral
    port returned to us by the OS won't immediately be dished back out to some
    other process when we close and delete our temporary socket but before our
    calling code has a chance to bind the returned port.  We can deal with this
    issue if/when we come across it."""
    tempsock = socket.socket(family, socktype)
    port = bind_port(tempsock)
    tempsock.close()
    del tempsock
    return port

def bind_port(sock, host=HOST):
    """Bind the socket to a free port and return the port number.  Relies on
    ephemeral ports in order to ensure we are using an unbound port.  This is
    important as many tests may be running simultaneously, especially in a
    buildbot environment.  This method raises an exception if the sock.family
    is AF_INET and sock.type is SOCK_STREAM, *and* the socket has SO_REUSEADDR
    or SO_REUSEPORT set on it.  Tests should *never* set these socket options
    for TCP/IP sockets.  The only case for setting these options is testing
    multicasting via multiple UDP sockets.

    Additionally, if the SO_EXCLUSIVEADDRUSE socket option is available (i.e.
    on Windows), it will be set on the socket.  This will prevent anyone else
    from bind()'ing to our host/port for the duration of the test.
    """
    if sock.family == socket.AF_INET and sock.type == socket.SOCK_STREAM:
        if hasattr(socket, 'SO_REUSEADDR'):
            if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) == 1:
                raise TestFailed("tests should never set the SO_REUSEADDR "   \
                                 "socket option on TCP/IP sockets!")
        if hasattr(socket, 'SO_REUSEPORT'):
            try:
                if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 1:
                    raise TestFailed("tests should never set the SO_REUSEPORT "   \
                                     "socket option on TCP/IP sockets!")
            except EnvironmentError:
                # Python's socket module was compiled using modern headers
                # thus defining SO_REUSEPORT but this process is running
                # under an older kernel that does not support SO_REUSEPORT.
                pass
        if hasattr(socket, 'SO_EXCLUSIVEADDRUSE'):
            sock.setsockopt(socket.SOL_SOCKET, socket.SO_EXCLUSIVEADDRUSE, 1)

    sock.bind((host, 0))
    port = sock.getsockname()[1]
    return port

def _is_ipv6_enabled():
    """Check whether IPv6 is enabled on this host."""
    if socket.has_ipv6:
        sock = None
        try:
            sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
            sock.bind((HOSTv6, 0))
            return True
        except socket.error:
            pass
        finally:
            if sock:
                sock.close()
    return False

IPV6_ENABLED = _is_ipv6_enabled()

def system_must_validate_cert(f):
    """Skip the test on TLS certificate validation failures."""
    @functools.wraps(f)
    def dec(*args, **kwargs):
        try:
            f(*args, **kwargs)
        except IOError as e:
            if "CERTIFICATE_VERIFY_FAILED" in str(e):
                raise unittest.SkipTest("system does not contain "
                                        "necessary certificates")
            raise
    return dec

FUZZ = 1e-6

def fcmp(x, y): # fuzzy comparison function
    if isinstance(x, float) or isinstance(y, float):
        try:
            fuzz = (abs(x) + abs(y)) * FUZZ
            if abs(x-y) <= fuzz:
                return 0
        except:
            pass
    elif type(x) == type(y) and isinstance(x, (tuple, list)):
        for i in range(min(len(x), len(y))):
            outcome = fcmp(x[i], y[i])
            if outcome != 0:
                return outcome
        return (len(x) > len(y)) - (len(x) < len(y))
    return (x > y) - (x < y)


# A constant likely larger than the underlying OS pipe buffer size, to
# make writes blocking.
# Windows limit seems to be around 512 B, and many Unix kernels have a
# 64 KiB pipe buffer size or 16 * PAGE_SIZE: take a few megs to be sure.
# (see issue #17835 for a discussion of this number).
PIPE_MAX_SIZE = 4 * 1024 * 1024 + 1

# A constant likely larger than the underlying OS socket buffer size, to make
# writes blocking.
# The socket buffer sizes can usually be tuned system-wide (e.g. through sysctl
# on Linux), or on a per-socket basis (SO_SNDBUF/SO_RCVBUF). See issue #18643
# for a discussion of this number).
SOCK_MAX_SIZE = 16 * 1024 * 1024 + 1

is_jython = sys.platform.startswith('java')

try:
    unicode
    have_unicode = True
except NameError:
    have_unicode = False

requires_unicode = unittest.skipUnless(have_unicode, 'no unicode support')

def u(s):
    return unicode(s, 'unicode-escape')

# FS_NONASCII: non-ASCII Unicode character encodable by
# sys.getfilesystemencoding(), or None if there is no such character.
FS_NONASCII = None
if have_unicode:
    for character in (
        # First try printable and common characters to have a readable filename.
        # For each character, the encoding list are just example of encodings able
        # to encode the character (the list is not exhaustive).

        # U+00E6 (Latin Small Letter Ae): cp1252, iso-8859-1
        unichr(0x00E6),
        # U+0130 (Latin Capital Letter I With Dot Above): cp1254, iso8859_3
        unichr(0x0130),
        # U+0141 (Latin Capital Letter L With Stroke): cp1250, cp1257
        unichr(0x0141),
        # U+03C6 (Greek Small Letter Phi): cp1253
        unichr(0x03C6),
        # U+041A (Cyrillic Capital Letter Ka): cp1251
        unichr(0x041A),
        # U+05D0 (Hebrew Letter Alef): Encodable to cp424
        unichr(0x05D0),
        # U+060C (Arabic Comma): cp864, cp1006, iso8859_6, mac_arabic
        unichr(0x060C),
        # U+062A (Arabic Letter Teh): cp720
        unichr(0x062A),
        # U+0E01 (Thai Character Ko Kai): cp874
        unichr(0x0E01),

        # Then try more "special" characters. "special" because they may be
        # interpreted or displayed differently depending on the exact locale
        # encoding and the font.

        # U+00A0 (No-Break Space)
        unichr(0x00A0),
        # U+20AC (Euro Sign)
        unichr(0x20AC),
    ):
        try:
            # In Windows, 'mbcs' is used, and encode() returns '?'
            # for characters missing in the ANSI codepage
            if character.encode(sys.getfilesystemencoding())\
                        .decode(sys.getfilesystemencoding())\
                    != character:
                raise UnicodeError
        except UnicodeError:
            pass
        else:
            FS_NONASCII = character
            break

# Filename used for testing
if os.name == 'java':
    # Jython disallows @ in module names
    TESTFN = '$test'
elif os.name == 'riscos':
    TESTFN = 'testfile'
else:
    TESTFN = '@test'
    # Unicode name only used if TEST_FN_ENCODING exists for the platform.
    if have_unicode:
        # Assuming sys.getfilesystemencoding()!=sys.getdefaultencoding()
        # TESTFN_UNICODE is a filename that can be encoded using the
        # file system encoding, but *not* with the default (ascii) encoding
        if isinstance('', unicode):
            # python -U
            # XXX perhaps unicode() should accept Unicode strings?
            TESTFN_UNICODE = "@test-\xe0\xf2"
        else:
            # 2 latin characters.
            TESTFN_UNICODE = unicode("@test-\xe0\xf2", "latin-1")
        TESTFN_ENCODING = sys.getfilesystemencoding()
        # TESTFN_UNENCODABLE is a filename that should *not* be
        # able to be encoded by *either* the default or filesystem encoding.
        # This test really only makes sense on Windows NT platforms
        # which have special Unicode support in posixmodule.
        if (not hasattr(sys, "getwindowsversion") or
                sys.getwindowsversion()[3] < 2): #  0=win32s or 1=9x/ME
            TESTFN_UNENCODABLE = None
        else:
            # Japanese characters (I think - from bug 846133)
            TESTFN_UNENCODABLE = eval('u"@test-\u5171\u6709\u3055\u308c\u308b"')
            try:
                # XXX - Note - should be using TESTFN_ENCODING here - but for
                # Windows, "mbcs" currently always operates as if in
                # errors=ignore' mode - hence we get '?' characters rather than
                # the exception.  'Latin1' operates as we expect - ie, fails.
                # See [ 850997 ] mbcs encoding ignores errors
                TESTFN_UNENCODABLE.encode("Latin1")
            except UnicodeEncodeError:
                pass
            else:
                print \
                'WARNING: The filename %r CAN be encoded by the filesystem.  ' \
                'Unicode filename tests may not be effective' \
                % TESTFN_UNENCODABLE


# Disambiguate TESTFN for parallel testing, while letting it remain a valid
# module name.
TESTFN = "{}_{}_tmp".format(TESTFN, os.getpid())

# Define the URL of a dedicated HTTP server for the network tests.
# The URL must use clear-text HTTP: no redirection to encrypted HTTPS.
TEST_HTTP_URL = "http://www.pythontest.net"

# Save the initial cwd
SAVEDCWD = os.getcwd()

@contextlib.contextmanager
def temp_dir(path=None, quiet=False):
    """Return a context manager that creates a temporary directory.

    Arguments:

      path: the directory to create temporarily.  If omitted or None,
        defaults to creating a temporary directory using tempfile.mkdtemp.

      quiet: if False (the default), the context manager raises an exception
        on error.  Otherwise, if the path is specified and cannot be
        created, only a warning is issued.

    """
    dir_created = False
    if path is None:
        import tempfile
        path = tempfile.mkdtemp()
        dir_created = True
        path = os.path.realpath(path)
    else:
        if (have_unicode and isinstance(path, unicode) and
            not os.path.supports_unicode_filenames):
            try:
                path = path.encode(sys.getfilesystemencoding() or 'ascii')
            except UnicodeEncodeError:
                if not quiet:
                    raise unittest.SkipTest('unable to encode the cwd name with '
                                            'the filesystem encoding.')
        try:
            os.mkdir(path)
            dir_created = True
        except OSError:
            if not quiet:
                raise
            warnings.warn('tests may fail, unable to create temp dir: ' + path,
                          RuntimeWarning, stacklevel=3)
    if dir_created:
        pid = os.getpid()
    try:
        yield path
    finally:
        # In case the process forks, let only the parent remove the
        # directory. The child has a diffent process id. (bpo-30028)
        if dir_created and pid == os.getpid():
            rmtree(path)

@contextlib.contextmanager
def change_cwd(path, quiet=False):
    """Return a context manager that changes the current working directory.

    Arguments:

      path: the directory to use as the temporary current working directory.

      quiet: if False (the default), the context manager raises an exception
        on error.  Otherwise, it issues only a warning and keeps the current
        working directory the same.

    """
    saved_dir = os.getcwd()
    try:
        os.chdir(path)
    except OSError:
        if not quiet:
            raise
        warnings.warn('tests may fail, unable to change CWD to: ' + path,
                      RuntimeWarning, stacklevel=3)
    try:
        yield os.getcwd()
    finally:
        os.chdir(saved_dir)


@contextlib.contextmanager
def temp_cwd(name='tempcwd', quiet=False):
    """
    Context manager that temporarily creates and changes the CWD.

    The function temporarily changes the current working directory
    after creating a temporary directory in the current directory with
    name *name*.  If *name* is None, the temporary directory is
    created using tempfile.mkdtemp.

    If *quiet* is False (default) and it is not possible to
    create or change the CWD, an error is raised.  If *quiet* is True,
    only a warning is raised and the original CWD is used.

    """
    with temp_dir(path=name, quiet=quiet) as temp_path:
        with change_cwd(temp_path, quiet=quiet) as cwd_dir:
            yield cwd_dir

# TEST_HOME_DIR refers to the top level directory of the "test" package
# that contains Python's regression test suite
TEST_SUPPORT_DIR = os.path.dirname(os.path.abspath(__file__))
TEST_HOME_DIR = os.path.dirname(TEST_SUPPORT_DIR)

# TEST_DATA_DIR is used as a target download location for remote resources
TEST_DATA_DIR = os.path.join(TEST_HOME_DIR, "data")

def findfile(file, subdir=None):
    """Try to find a file on sys.path and the working directory.  If it is not
    found the argument passed to the function is returned (this does not
    necessarily signal failure; could still be the legitimate path)."""
    if os.path.isabs(file):
        return file
    if subdir is not None:
        file = os.path.join(subdir, file)
    path = [TEST_HOME_DIR] + sys.path
    for dn in path:
        fn = os.path.join(dn, file)
        if os.path.exists(fn): return fn
    return file

def sortdict(dict):
    "Like repr(dict), but in sorted order."
    items = dict.items()
    items.sort()
    reprpairs = ["%r: %r" % pair for pair in items]
    withcommas = ", ".join(reprpairs)
    return "{%s}" % withcommas

def make_bad_fd():
    """
    Create an invalid file descriptor by opening and closing a file and return
    its fd.
    """
    file = open(TESTFN, "wb")
    try:
        return file.fileno()
    finally:
        file.close()
        unlink(TESTFN)

def check_syntax_error(testcase, statement, errtext='', lineno=None, offset=None):
    with testcase.assertRaisesRegexp(SyntaxError, errtext) as cm:
        compile(statement, '<test string>', 'exec')
    err = cm.exception
    if lineno is not None:
        testcase.assertEqual(err.lineno, lineno)
    if offset is not None:
        testcase.assertEqual(err.offset, offset)

def open_urlresource(url, check=None):
    import urlparse, urllib2

    filename = urlparse.urlparse(url)[2].split('/')[-1] # '/': it's URL!

    fn = os.path.join(TEST_DATA_DIR, filename)

    def check_valid_file(fn):
        f = open(fn)
        if check is None:
            return f
        elif check(f):
            f.seek(0)
            return f
        f.close()

    if os.path.exists(fn):
        f = check_valid_file(fn)
        if f is not None:
            return f
        unlink(fn)

    # Verify the requirement before downloading the file
    requires('urlfetch')

    print >> get_original_stdout(), '\tfetching %s ...' % url
    f = urllib2.urlopen(url, timeout=15)
    try:
        with open(fn, "wb") as out:
            s = f.read()
            while s:
                out.write(s)
                s = f.read()
    finally:
        f.close()

    f = check_valid_file(fn)
    if f is not None:
        return f
    raise TestFailed('invalid resource "%s"' % fn)


class WarningsRecorder(object):
    """Convenience wrapper for the warnings list returned on
       entry to the warnings.catch_warnings() context manager.
    """
    def __init__(self, warnings_list):
        self._warnings = warnings_list
        self._last = 0

    def __getattr__(self, attr):
        if len(self._warnings) > self._last:
            return getattr(self._warnings[-1], attr)
        elif attr in warnings.WarningMessage._WARNING_DETAILS:
            return None
        raise AttributeError("%r has no attribute %r" % (self, attr))

    @property
    def warnings(self):
        return self._warnings[self._last:]

    def reset(self):
        self._last = len(self._warnings)


def _filterwarnings(filters, quiet=False):
    """Catch the warnings, then check if all the expected
    warnings have been raised and re-raise unexpected warnings.
    If 'quiet' is True, only re-raise the unexpected warnings.
    """
    # Clear the warning registry of the calling module
    # in order to re-raise the warnings.
    frame = sys._getframe(2)
    registry = frame.f_globals.get('__warningregistry__')
    if registry:
        registry.clear()
    with warnings.catch_warnings(record=True) as w:
        # Set filter "always" to record all warnings.  Because
        # test_warnings swap the module, we need to look up in
        # the sys.modules dictionary.
        sys.modules['warnings'].simplefilter("always")
        yield WarningsRecorder(w)
    # Filter the recorded warnings
    reraise = [warning.message for warning in w]
    missing = []
    for msg, cat in filters:
        seen = False
        for exc in reraise[:]:
            message = str(exc)
            # Filter out the matching messages
            if (re.match(msg, message, re.I) and
                issubclass(exc.__class__, cat)):
                seen = True
                reraise.remove(exc)
        if not seen and not quiet:
            # This filter caught nothing
            missing.append((msg, cat.__name__))
    if reraise:
        raise AssertionError("unhandled warning %r" % reraise[0])
    if missing:
        raise AssertionError("filter (%r, %s) did not catch any warning" %
                             missing[0])


@contextlib.contextmanager
def check_warnings(*filters, **kwargs):
    """Context manager to silence warnings.

    Accept 2-tuples as positional arguments:
        ("message regexp", WarningCategory)

    Optional argument:
     - if 'quiet' is True, it does not fail if a filter catches nothing
        (default True without argument,
         default False if some filters are defined)

    Without argument, it defaults to:
        check_warnings(("", Warning), quiet=True)
    """
    quiet = kwargs.get('quiet')
    if not filters:
        filters = (("", Warning),)
        # Preserve backward compatibility
        if quiet is None:
            quiet = True
    return _filterwarnings(filters, quiet)


@contextlib.contextmanager
def check_py3k_warnings(*filters, **kwargs):
    """Context manager to silence py3k warnings.

    Accept 2-tuples as positional arguments:
        ("message regexp", WarningCategory)

    Optional argument:
     - if 'quiet' is True, it does not fail if a filter catches nothing
        (default False)

    Without argument, it defaults to:
        check_py3k_warnings(("", DeprecationWarning), quiet=False)
    """
    if sys.py3kwarning:
        if not filters:
            filters = (("", DeprecationWarning),)
    else:
        # It should not raise any py3k warning
        filters = ()
    return _filterwarnings(filters, kwargs.get('quiet'))


class CleanImport(object):
    """Context manager to force import to return a new module reference.

    This is useful for testing module-level behaviours, such as
    the emission of a DeprecationWarning on import.

    Use like this:

        with CleanImport("foo"):
            importlib.import_module("foo") # new reference
    """

    def __init__(self, *module_names):
        self.original_modules = sys.modules.copy()
        for module_name in module_names:
            if module_name in sys.modules:
                module = sys.modules[module_name]
                # It is possible that module_name is just an alias for
                # another module (e.g. stub for modules renamed in 3.x).
                # In that case, we also need delete the real module to clear
                # the import cache.
                if module.__name__ != module_name:
                    del sys.modules[module.__name__]
                del sys.modules[module_name]

    def __enter__(self):
        return self

    def __exit__(self, *ignore_exc):
        sys.modules.update(self.original_modules)


class EnvironmentVarGuard(UserDict.DictMixin):

    """Class to help protect the environment variable properly.  Can be used as
    a context manager."""

    def __init__(self):
        self._environ = os.environ
        self._changed = {}

    def __getitem__(self, envvar):
        return self._environ[envvar]

    def __setitem__(self, envvar, value):
        # Remember the initial value on the first access
        if envvar not in self._changed:
            self._changed[envvar] = self._environ.get(envvar)
        self._environ[envvar] = value

    def __delitem__(self, envvar):
        # Remember the initial value on the first access
        if envvar not in self._changed:
            self._changed[envvar] = self._environ.get(envvar)
        if envvar in self._environ:
            del self._environ[envvar]

    def keys(self):
        return self._environ.keys()

    def set(self, envvar, value):
        self[envvar] = value

    def unset(self, envvar):
        del self[envvar]

    def __enter__(self):
        return self

    def __exit__(self, *ignore_exc):
        for (k, v) in self._changed.items():
            if v is None:
                if k in self._environ:
                    del self._environ[k]
            else:
                self._environ[k] = v
        os.environ = self._environ


class DirsOnSysPath(object):
    """Context manager to temporarily add directories to sys.path.

    This makes a copy of sys.path, appends any directories given
    as positional arguments, then reverts sys.path to the copied
    settings when the context ends.

    Note that *all* sys.path modifications in the body of the
    context manager, including replacement of the object,
    will be reverted at the end of the block.
    """

    def __init__(self, *paths):
        self.original_value = sys.path[:]
        self.original_object = sys.path
        sys.path.extend(paths)

    def __enter__(self):
        return self

    def __exit__(self, *ignore_exc):
        sys.path = self.original_object
        sys.path[:] = self.original_value


class TransientResource(object):

    """Raise ResourceDenied if an exception is raised while the context manager
    is in effect that matches the specified exception and attributes."""

    def __init__(self, exc, **kwargs):
        self.exc = exc
        self.attrs = kwargs

    def __enter__(self):
        return self

    def __exit__(self, type_=None, value=None, traceback=None):
        """If type_ is a subclass of self.exc and value has attributes matching
        self.attrs, raise ResourceDenied.  Otherwise let the exception
        propagate (if any)."""
        if type_ is not None and issubclass(self.exc, type_):
            for attr, attr_value in self.attrs.iteritems():
                if not hasattr(value, attr):
                    break
                if getattr(value, attr) != attr_value:
                    break
            else:
                raise ResourceDenied("an optional resource is not available")


@contextlib.contextmanager
def transient_internet(resource_name, timeout=30.0, errnos=()):
    """Return a context manager that raises ResourceDenied when various issues
    with the Internet connection manifest themselves as exceptions."""
    default_errnos = [
        ('ECONNREFUSED', 111),
        ('ECONNRESET', 104),
        ('EHOSTUNREACH', 113),
        ('ENETUNREACH', 101),
        ('ETIMEDOUT', 110),
        # socket.create_connection() fails randomly with
        # EADDRNOTAVAIL on Travis CI.
        ('EADDRNOTAVAIL', 99),
    ]
    default_gai_errnos = [
        ('EAI_AGAIN', -3),
        ('EAI_FAIL', -4),
        ('EAI_NONAME', -2),
        ('EAI_NODATA', -5),
        # Windows defines EAI_NODATA as 11001 but idiotic getaddrinfo()
        # implementation actually returns WSANO_DATA i.e. 11004.
        ('WSANO_DATA', 11004),
    ]

    denied = ResourceDenied("Resource '%s' is not available" % resource_name)
    captured_errnos = errnos
    gai_errnos = []
    if not captured_errnos:
        captured_errnos = [getattr(errno, name, num)
                           for (name, num) in default_errnos]
        gai_errnos = [getattr(socket, name, num)
                      for (name, num) in default_gai_errnos]

    def filter_error(err):
        n = getattr(err, 'errno', None)
        if (isinstance(err, socket.timeout) or
            (isinstance(err, socket.gaierror) and n in gai_errnos) or
            n in captured_errnos):
            if not verbose:
                sys.stderr.write(denied.args[0] + "\n")
            raise denied

    old_timeout = socket.getdefaulttimeout()
    try:
        if timeout is not None:
            socket.setdefaulttimeout(timeout)
        yield
    except IOError as err:
        # urllib can wrap original socket errors multiple times (!), we must
        # unwrap to get at the original error.
        while True:
            a = err.args
            if len(a) >= 1 and isinstance(a[0], IOError):
                err = a[0]
            # The error can also be wrapped as args[1]:
            #    except socket.error as msg:
            #        raise IOError('socket error', msg).with_traceback(sys.exc_info()[2])
            elif len(a) >= 2 and isinstance(a[1], IOError):
                err = a[1]
            else:
                break
        filter_error(err)
        raise
    # XXX should we catch generic exceptions and look for their
    # __cause__ or __context__?
    finally:
        socket.setdefaulttimeout(old_timeout)


@contextlib.contextmanager
def captured_output(stream_name):
    """Return a context manager used by captured_stdout and captured_stdin
    that temporarily replaces the sys stream *stream_name* with a StringIO."""
    import StringIO
    orig_stdout = getattr(sys, stream_name)
    setattr(sys, stream_name, StringIO.StringIO())
    try:
        yield getattr(sys, stream_name)
    finally:
        setattr(sys, stream_name, orig_stdout)

def captured_stdout():
    """Capture the output of sys.stdout:

       with captured_stdout() as s:
           print "hello"
       self.assertEqual(s.getvalue(), "hello")
    """
    return captured_output("stdout")

def captured_stderr():
    return captured_output("stderr")

def captured_stdin():
    return captured_output("stdin")

def gc_collect():
    """Force as many objects as possible to be collected.

    In non-CPython implementations of Python, this is needed because timely
    deallocation is not guaranteed by the garbage collector.  (Even in CPython
    this can be the case in case of reference cycles.)  This means that __del__
    methods may be called later than expected and weakrefs may remain alive for
    longer than expected.  This function tries its best to force all garbage
    objects to disappear.
    """
    gc.collect()
    if is_jython:
        time.sleep(0.1)
    gc.collect()
    gc.collect()


_header = '2P'
if hasattr(sys, "gettotalrefcount"):
    _header = '2P' + _header
_vheader = _header + 'P'

def calcobjsize(fmt):
    return struct.calcsize(_header + fmt + '0P')

def calcvobjsize(fmt):
    return struct.calcsize(_vheader + fmt + '0P')


_TPFLAGS_HAVE_GC = 1<<14
_TPFLAGS_HEAPTYPE = 1<<9

def check_sizeof(test, o, size):
    import _testcapi
    result = sys.getsizeof(o)
    # add GC header size
    if ((type(o) == type) and (o.__flags__ & _TPFLAGS_HEAPTYPE) or\
        ((type(o) != type) and (type(o).__flags__ & _TPFLAGS_HAVE_GC))):
        size += _testcapi.SIZEOF_PYGC_HEAD
    msg = 'wrong size for %s: got %d, expected %d' \
            % (type(o), result, size)
    test.assertEqual(result, size, msg)


#=======================================================================
# Decorator for running a function in a different locale, correctly resetting
# it afterwards.

def run_with_locale(catstr, *locales):
    def decorator(func):
        def inner(*args, **kwds):
            try:
                import locale
                category = getattr(locale, catstr)
                orig_locale = locale.setlocale(category)
            except AttributeError:
                # if the test author gives us an invalid category string
                raise
            except:
                # cannot retrieve original locale, so do nothing
                locale = orig_locale = None
            else:
                for loc in locales:
                    try:
                        locale.setlocale(category, loc)
                        break
                    except:
                        pass

            # now run the function, resetting the locale on exceptions
            try:
                return func(*args, **kwds)
            finally:
                if locale and orig_locale:
                    locale.setlocale(category, orig_locale)
        inner.func_name = func.func_name
        inner.__doc__ = func.__doc__
        return inner
    return decorator

#=======================================================================
# Decorator for running a function in a specific timezone, correctly
# resetting it afterwards.

def run_with_tz(tz):
    def decorator(func):
        def inner(*args, **kwds):
            try:
                tzset = time.tzset
            except AttributeError:
                raise unittest.SkipTest("tzset required")
            if 'TZ' in os.environ:
                orig_tz = os.environ['TZ']
            else:
                orig_tz = None
            os.environ['TZ'] = tz
            tzset()

            # now run the function, resetting the tz on exceptions
            try:
                return func(*args, **kwds)
            finally:
                if orig_tz is None:
                    del os.environ['TZ']
                else:
                    os.environ['TZ'] = orig_tz
                time.tzset()

        inner.__name__ = func.__name__
        inner.__doc__ = func.__doc__
        return inner
    return decorator

#=======================================================================
# Big-memory-test support. Separate from 'resources' because memory use should be configurable.

# Some handy shorthands. Note that these are used for byte-limits as well
# as size-limits, in the various bigmem tests
_1M = 1024*1024
_1G = 1024 * _1M
_2G = 2 * _1G
_4G = 4 * _1G

MAX_Py_ssize_t = sys.maxsize

def set_memlimit(limit):
    global max_memuse
    global real_max_memuse
    sizes = {
        'k': 1024,
        'm': _1M,
        'g': _1G,
        't': 1024*_1G,
    }
    m = re.match(r'(\d+(\.\d+)?) (K|M|G|T)b?$', limit,
                 re.IGNORECASE | re.VERBOSE)
    if m is None:
        raise ValueError('Invalid memory limit %r' % (limit,))
    memlimit = int(float(m.group(1)) * sizes[m.group(3).lower()])
    real_max_memuse = memlimit
    if memlimit > MAX_Py_ssize_t:
        memlimit = MAX_Py_ssize_t
    if memlimit < _2G - 1:
        raise ValueError('Memory limit %r too low to be useful' % (limit,))
    max_memuse = memlimit

def bigmemtest(minsize, memuse, overhead=5*_1M):
    """Decorator for bigmem tests.

    'minsize' is the minimum useful size for the test (in arbitrary,
    test-interpreted units.) 'memuse' is the number of 'bytes per size' for
    the test, or a good estimate of it. 'overhead' specifies fixed overhead,
    independent of the testsize, and defaults to 5Mb.

    The decorator tries to guess a good value for 'size' and passes it to
    the decorated test function. If minsize * memuse is more than the
    allowed memory use (as defined by max_memuse), the test is skipped.
    Otherwise, minsize is adjusted upward to use up to max_memuse.
    """
    def decorator(f):
        def wrapper(self):
            if not max_memuse:
                # If max_memuse is 0 (the default),
                # we still want to run the tests with size set to a few kb,
                # to make sure they work. We still want to avoid using
                # too much memory, though, but we do that noisily.
                maxsize = 5147
                self.assertFalse(maxsize * memuse + overhead > 20 * _1M)
            else:
                maxsize = int((max_memuse - overhead) / memuse)
                if maxsize < minsize:
                    # Really ought to print 'test skipped' or something
                    if verbose:
                        sys.stderr.write("Skipping %s because of memory "
                                         "constraint\n" % (f.__name__,))
                    return
                # Try to keep some breathing room in memory use
                maxsize = max(maxsize - 50 * _1M, minsize)
            return f(self, maxsize)
        wrapper.minsize = minsize
        wrapper.memuse = memuse
        wrapper.overhead = overhead
        return wrapper
    return decorator

def precisionbigmemtest(size, memuse, overhead=5*_1M, dry_run=True):
    def decorator(f):
        def wrapper(self):
            if not real_max_memuse:
                maxsize = 5147
            else:
                maxsize = size

            if ((real_max_memuse or not dry_run)
                and real_max_memuse < maxsize * memuse):
                if verbose:
                    sys.stderr.write("Skipping %s because of memory "
                                     "constraint\n" % (f.__name__,))
                return

            return f(self, maxsize)
        wrapper.size = size
        wrapper.memuse = memuse
        wrapper.overhead = overhead
        return wrapper
    return decorator

def bigaddrspacetest(f):
    """Decorator for tests that fill the address space."""
    def wrapper(self):
        if max_memuse < MAX_Py_ssize_t:
            if verbose:
                sys.stderr.write("Skipping %s because of memory "
                                 "constraint\n" % (f.__name__,))
        else:
            return f(self)
    return wrapper

#=======================================================================
# unittest integration.

class BasicTestRunner:
    def run(self, test):
        result = unittest.TestResult()
        test(result)
        return result

def _id(obj):
    return obj

def requires_resource(resource):
    if resource == 'gui' and not _is_gui_available():
        return unittest.skip(_is_gui_available.reason)
    if is_resource_enabled(resource):
        return _id
    else:
        return unittest.skip("resource {0!r} is not enabled".format(resource))

def cpython_only(test):
    """
    Decorator for tests only applicable on CPython.
    """
    return impl_detail(cpython=True)(test)

def impl_detail(msg=None, **guards):
    if check_impl_detail(**guards):
        return _id
    if msg is None:
        guardnames, default = _parse_guards(guards)
        if default:
            msg = "implementation detail not available on {0}"
        else:
            msg = "implementation detail specific to {0}"
        guardnames = sorted(guardnames.keys())
        msg = msg.format(' or '.join(guardnames))
    return unittest.skip(msg)

def _parse_guards(guards):
    # Returns a tuple ({platform_name: run_me}, default_value)
    if not guards:
        return ({'cpython': True}, False)
    is_true = guards.values()[0]
    assert guards.values() == [is_true] * len(guards)   # all True or all False
    return (guards, not is_true)

# Use the following check to guard CPython's implementation-specific tests --
# or to run them only on the implementation(s) guarded by the arguments.
def check_impl_detail(**guards):
    """This function returns True or False depending on the host platform.
       Examples:
          if check_impl_detail():               # only on CPython (default)
          if check_impl_detail(jython=True):    # only on Jython
          if check_impl_detail(cpython=False):  # everywhere except on CPython
    """
    guards, default = _parse_guards(guards)
    return guards.get(platform.python_implementation().lower(), default)


def _filter_suite(suite, pred):
    """Recursively filter test cases in a suite based on a predicate."""
    newtests = []
    for test in suite._tests:
        if isinstance(test, unittest.TestSuite):
            _filter_suite(test, pred)
            newtests.append(test)
        else:
            if pred(test):
                newtests.append(test)
    suite._tests = newtests

def _run_suite(suite):
    """Run tests from a unittest.TestSuite-derived class."""
    if verbose:
        runner = unittest.TextTestRunner(sys.stdout, verbosity=2,
                                         failfast=failfast)
    else:
        runner = BasicTestRunner()

    result = runner.run(suite)
    if not result.testsRun and not result.skipped:
        raise TestDidNotRun
    if not result.wasSuccessful():
        if len(result.errors) == 1 and not result.failures:
            err = result.errors[0][1]
        elif len(result.failures) == 1 and not result.errors:
            err = result.failures[0][1]
        else:
            err = "multiple errors occurred"
            if not verbose:
                err += "; run in verbose mode for details"
        raise TestFailed(err)


# By default, don't filter tests
_match_test_func = None
_match_test_patterns = None


def match_test(test):
    # Function used by support.run_unittest() and regrtest --list-cases
    if _match_test_func is None:
        return True
    else:
        return _match_test_func(test.id())


def _is_full_match_test(pattern):
    # If a pattern contains at least one dot, it's considered
    # as a full test identifier.
    # Example: 'test.test_os.FileTests.test_access'.
    #
    # Reject patterns which contain fnmatch patterns: '*', '?', '[...]'
    # or '[!...]'. For example, reject 'test_access*'.
    return ('.' in pattern) and (not re.search(r'[?*\[\]]', pattern))


def set_match_tests(patterns):
    global _match_test_func, _match_test_patterns

    if patterns == _match_test_patterns:
        # No change: no need to recompile patterns.
        return

    if not patterns:
        func = None
        # set_match_tests(None) behaves as set_match_tests(())
        patterns = ()
    elif all(map(_is_full_match_test, patterns)):
        # Simple case: all patterns are full test identifier.
        # The test.bisect utility only uses such full test identifiers.
        func = set(patterns).__contains__
    else:
        regex = '|'.join(map(fnmatch.translate, patterns))
        # The search *is* case sensitive on purpose:
        # don't use flags=re.IGNORECASE
        regex_match = re.compile(regex).match

        def match_test_regex(test_id):
            if regex_match(test_id):
                # The regex matchs the whole identifier like
                # 'test.test_os.FileTests.test_access'
                return True
            else:
                # Try to match parts of the test identifier.
                # For example, split 'test.test_os.FileTests.test_access'
                # into: 'test', 'test_os', 'FileTests' and 'test_access'.
                return any(map(regex_match, test_id.split(".")))

        func = match_test_regex

    # Create a copy since patterns can be mutable and so modified later
    _match_test_patterns = tuple(patterns)
    _match_test_func = func



def run_unittest(*classes):
    """Run tests from unittest.TestCase-derived classes."""
    valid_types = (unittest.TestSuite, unittest.TestCase)
    suite = unittest.TestSuite()
    for cls in classes:
        if isinstance(cls, str):
            if cls in sys.modules:
                suite.addTest(unittest.findTestCases(sys.modules[cls]))
            else:
                raise ValueError("str arguments must be keys in sys.modules")
        elif isinstance(cls, valid_types):
            suite.addTest(cls)
        else:
            suite.addTest(unittest.makeSuite(cls))
    _filter_suite(suite, match_test)
    _run_suite(suite)

#=======================================================================
# Check for the presence of docstrings.

HAVE_DOCSTRINGS = (check_impl_detail(cpython=False) or
                   sys.platform == 'win32' or
                   sysconfig.get_config_var('WITH_DOC_STRINGS'))

requires_docstrings = unittest.skipUnless(HAVE_DOCSTRINGS,
                                          "test requires docstrings")


#=======================================================================
# doctest driver.

def run_doctest(module, verbosity=None):
    """Run doctest on the given module.  Return (#failures, #tests).

    If optional argument verbosity is not specified (or is None), pass
    test.support's belief about verbosity on to doctest.  Else doctest's
    usual behavior is used (it searches sys.argv for -v).
    """

    import doctest

    if verbosity is None:
        verbosity = verbose
    else:
        verbosity = None

    # Direct doctest output (normally just errors) to real stdout; doctest
    # output shouldn't be compared by regrtest.
    save_stdout = sys.stdout
    sys.stdout = get_original_stdout()
    try:
        f, t = doctest.testmod(module, verbose=verbosity)
        if f:
            raise TestFailed("%d of %d doctests failed" % (f, t))
    finally:
        sys.stdout = save_stdout
    if verbose:
        print 'doctest (%s) ... %d tests with zero failures' % (module.__name__, t)
    return f, t

#=======================================================================
# Threading support to prevent reporting refleaks when running regrtest.py -R

# Flag used by saved_test_environment of test.libregrtest.save_env,
# to check if a test modified the environment. The flag should be set to False
# before running a new test.
#
# For example, threading_cleanup() sets the flag is the function fails
# to cleanup threads.
environment_altered = False

# NOTE: we use thread._count() rather than threading.enumerate() (or the
# moral equivalent thereof) because a threading.Thread object is still alive
# until its __bootstrap() method has returned, even after it has been
# unregistered from the threading module.
# thread._count(), on the other hand, only gets decremented *after* the
# __bootstrap() method has returned, which gives us reliable reference counts
# at the end of a test run.

def threading_setup():
    if thread:
        return thread._count(),
    else:
        return 1,

def threading_cleanup(nb_threads):
    if not thread:
        return

    _MAX_COUNT = 10
    for count in range(_MAX_COUNT):
        n = thread._count()
        if n == nb_threads:
            break
        time.sleep(0.1)
    # XXX print a warning in case of failure?

def reap_threads(func):
    """Use this function when threads are being used.  This will
    ensure that the threads are cleaned up even when the test fails.
    If threading is unavailable this function does nothing.
    """
    if not thread:
        return func

    @functools.wraps(func)
    def decorator(*args):
        key = threading_setup()
        try:
            return func(*args)
        finally:
            threading_cleanup(*key)
    return decorator


@contextlib.contextmanager
def wait_threads_exit(timeout=60.0):
    """
    bpo-31234: Context manager to wait until all threads created in the with
    statement exit.

    Use thread.count() to check if threads exited. Indirectly, wait until
    threads exit the internal t_bootstrap() C function of the thread module.

    threading_setup() and threading_cleanup() are designed to emit a warning
    if a test leaves running threads in the background. This context manager
    is designed to cleanup threads started by the thread.start_new_thread()
    which doesn't allow to wait for thread exit, whereas thread.Thread has a
    join() method.
    """
    old_count = thread._count()
    try:
        yield
    finally:
        start_time = time.time()
        deadline = start_time + timeout
        while True:
            count = thread._count()
            if count <= old_count:
                break
            if time.time() > deadline:
                dt = time.time() - start_time
                msg = ("wait_threads() failed to cleanup %s "
                       "threads after %.1f seconds "
                       "(count: %s, old count: %s)"
                       % (count - old_count, dt, count, old_count))
                raise AssertionError(msg)
            time.sleep(0.010)
            gc_collect()


def reap_children():
    """Use this function at the end of test_main() whenever sub-processes
    are started.  This will help ensure that no extra children (zombies)
    stick around to hog resources and create problems when looking
    for refleaks.
    """

    # Reap all our dead child processes so we don't leave zombies around.
    # These hog resources and might be causing some of the buildbots to die.
    if hasattr(os, 'waitpid'):
        any_process = -1
        while True:
            try:
                # This will raise an exception on Windows.  That's ok.
                pid, status = os.waitpid(any_process, os.WNOHANG)
                if pid == 0:
                    break
            except:
                break

@contextlib.contextmanager
def start_threads(threads, unlock=None):
    threads = list(threads)
    started = []
    try:
        try:
            for t in threads:
                t.start()
                started.append(t)
        except:
            if verbose:
                print("Can't start %d threads, only %d threads started" %
                      (len(threads), len(started)))
            raise
        yield
    finally:
        if unlock:
            unlock()
        endtime = starttime = time.time()
        for timeout in range(1, 16):
            endtime += 60
            for t in started:
                t.join(max(endtime - time.time(), 0.01))
            started = [t for t in started if t.isAlive()]
            if not started:
                break
            if verbose:
                print('Unable to join %d threads during a period of '
                      '%d minutes' % (len(started), timeout))
    started = [t for t in started if t.isAlive()]
    if started:
        raise AssertionError('Unable to join %d threads' % len(started))

@contextlib.contextmanager
def swap_attr(obj, attr, new_val):
    """Temporary swap out an attribute with a new object.

    Usage:
        with swap_attr(obj, "attr", 5):
            ...

        This will set obj.attr to 5 for the duration of the with: block,
        restoring the old value at the end of the block. If `attr` doesn't
        exist on `obj`, it will be created and then deleted at the end of the
        block.

        The old value (or None if it doesn't exist) will be assigned to the
        target of the "as" clause, if there is one.
    """
    if hasattr(obj, attr):
        real_val = getattr(obj, attr)
        setattr(obj, attr, new_val)
        try:
            yield real_val
        finally:
            setattr(obj, attr, real_val)
    else:
        setattr(obj, attr, new_val)
        try:
            yield
        finally:
            if hasattr(obj, attr):
                delattr(obj, attr)

@contextlib.contextmanager
def swap_item(obj, item, new_val):
    """Temporary swap out an item with a new object.

    Usage:
        with swap_item(obj, "item", 5):
            ...

        This will set obj["item"] to 5 for the duration of the with: block,
        restoring the old value at the end of the block. If `item` doesn't
        exist on `obj`, it will be created and then deleted at the end of the
        block.

        The old value (or None if it doesn't exist) will be assigned to the
        target of the "as" clause, if there is one.
    """
    if item in obj:
        real_val = obj[item]
        obj[item] = new_val
        try:
            yield real_val
        finally:
            obj[item] = real_val
    else:
        obj[item] = new_val
        try:
            yield
        finally:
            if item in obj:
                del obj[item]

def py3k_bytes(b):
    """Emulate the py3k bytes() constructor.

    NOTE: This is only a best effort function.
    """
    try:
        # memoryview?
        return b.tobytes()
    except AttributeError:
        try:
            # iterable of ints?
            return b"".join(chr(x) for x in b)
        except TypeError:
            return bytes(b)

requires_type_collecting = unittest.skipIf(hasattr(sys, 'getcounts'),
                        'types are immortal if COUNT_ALLOCS is defined')

def args_from_interpreter_flags():
    """Return a list of command-line arguments reproducing the current
    settings in sys.flags."""
    import subprocess
    return subprocess._args_from_interpreter_flags()

def strip_python_stderr(stderr):
    """Strip the stderr of a Python process from potential debug output
    emitted by the interpreter.

    This will typically be run on the result of the communicate() method
    of a subprocess.Popen object.
    """
    stderr = re.sub(br"\[\d+ refs\]\r?\n?$", b"", stderr).strip()
    return stderr


def check_free_after_iterating(test, iter, cls, args=()):
    class A(cls):
        def __del__(self):
            done[0] = True
            try:
                next(it)
            except StopIteration:
                pass

    done = [False]
    it = iter(A(*args))
    # Issue 26494: Shouldn't crash
    test.assertRaises(StopIteration, next, it)
    # The sequence should be deallocated just after the end of iterating
    gc_collect()
    test.assertTrue(done[0])

@contextlib.contextmanager
def disable_gc():
    have_gc = gc.isenabled()
    gc.disable()
    try:
        yield
    finally:
        if have_gc:
            gc.enable()


def python_is_optimized():
    """Find if Python was built with optimizations."""
    cflags = sysconfig.get_config_var('PY_CFLAGS') or ''
    final_opt = ""
    for opt in cflags.split():
        if opt.startswith('-O'):
            final_opt = opt
    return final_opt not in ('', '-O0', '-Og')


class SuppressCrashReport:
    """Try to prevent a crash report from popping up.

    On Windows, don't display the Windows Error Reporting dialog.  On UNIX,
    disable the creation of coredump file.
    """
    old_value = None
    old_modes = None

    def __enter__(self):
        """On Windows, disable Windows Error Reporting dialogs using
        SetErrorMode.

        On UNIX, try to save the previous core file size limit, then set
        soft limit to 0.
        """
        if sys.platform.startswith('win'):
            # see http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621.aspx
            # GetErrorMode is not available on Windows XP and Windows Server 2003,
            # but SetErrorMode returns the previous value, so we can use that
            import ctypes
            self._k32 = ctypes.windll.kernel32
            SEM_NOGPFAULTERRORBOX = 0x02
            self.old_value = self._k32.SetErrorMode(SEM_NOGPFAULTERRORBOX)
            self._k32.SetErrorMode(self.old_value | SEM_NOGPFAULTERRORBOX)

            # Suppress assert dialogs in debug builds
            # (see http://bugs.python.org/issue23314)
            try:
                import _testcapi
                _testcapi.CrtSetReportMode
            except (AttributeError, ImportError):
                # no _testcapi or a release build
                pass
            else:
                self.old_modes = {}
                for report_type in [_testcapi.CRT_WARN,
                                    _testcapi.CRT_ERROR,
                                    _testcapi.CRT_ASSERT]:
                    old_mode = _testcapi.CrtSetReportMode(report_type,
                            _testcapi.CRTDBG_MODE_FILE)
                    old_file = _testcapi.CrtSetReportFile(report_type,
                            _testcapi.CRTDBG_FILE_STDERR)
                    self.old_modes[report_type] = old_mode, old_file

        else:
            try:
                import resource
            except ImportError:
                resource = None

            if resource is not None:
                try:
                    self.old_value = resource.getrlimit(resource.RLIMIT_CORE)
                    resource.setrlimit(resource.RLIMIT_CORE,
                                       (0, self.old_value[1]))
                except (ValueError, OSError):
                    pass

            if sys.platform == 'darwin':
                # Check if the 'Crash Reporter' on OSX was configured
                # in 'Developer' mode and warn that it will get triggered
                # when it is.
                #
                # This assumes that this context manager is used in tests
                # that might trigger the next manager.
                import subprocess
                cmd = ['/usr/bin/defaults', 'read',
                       'com.apple.CrashReporter', 'DialogType']
                proc = subprocess.Popen(cmd,
                                        stdout=subprocess.PIPE,
                                        stderr=subprocess.PIPE)
                stdout = proc.communicate()[0]
                if stdout.strip() == b'developer':
                    sys.stdout.write("this test triggers the Crash Reporter, "
                                     "that is intentional")
                    sys.stdout.flush()

        return self

    def __exit__(self, *ignore_exc):
        """Restore Windows ErrorMode or core file behavior to initial value."""
        if self.old_value is None:
            return

        if sys.platform.startswith('win'):
            self._k32.SetErrorMode(self.old_value)

            if self.old_modes:
                import _testcapi
                for report_type, (old_mode, old_file) in self.old_modes.items():
                    _testcapi.CrtSetReportMode(report_type, old_mode)
                    _testcapi.CrtSetReportFile(report_type, old_file)
        else:
            import resource
            try:
                resource.setrlimit(resource.RLIMIT_CORE, self.old_value)
            except (ValueError, OSError):
                pass


def _crash_python():
    """Deliberate crash of Python.

    Python can be killed by a segmentation fault (SIGSEGV), a bus error
    (SIGBUS), or a different error depending on the platform.

    Use SuppressCrashReport() to prevent a crash report from popping up.
    """

    import _testcapi
    with SuppressCrashReport():
        _testcapi._read_null()


def fd_count():
    """Count the number of open file descriptors.
    """
    if sys.platform.startswith(('linux', 'freebsd')):
        try:
            names = os.listdir("/proc/self/fd")
            # Substract one because listdir() opens internally a file
            # descriptor to list the content of the /proc/self/fd/ directory.
            return len(names) - 1
        except OSError as exc:
            if exc.errno != errno.ENOENT:
                raise

    MAXFD = 256
    if hasattr(os, 'sysconf'):
        try:
            MAXFD = os.sysconf("SC_OPEN_MAX")
        except OSError:
            pass

    old_modes = None
    if sys.platform == 'win32':
        # bpo-25306, bpo-31009: Call CrtSetReportMode() to not kill the process
        # on invalid file descriptor if Python is compiled in debug mode
        try:
            import msvcrt
            msvcrt.CrtSetReportMode
        except (AttributeError, ImportError):
            # no msvcrt or a release build
            pass
        else:
            old_modes = {}
            for report_type in (msvcrt.CRT_WARN,
                                msvcrt.CRT_ERROR,
                                msvcrt.CRT_ASSERT):
                old_modes[report_type] = msvcrt.CrtSetReportMode(report_type, 0)

    try:
        count = 0
        for fd in range(MAXFD):
            try:
                # Prefer dup() over fstat(). fstat() can require input/output
                # whereas dup() doesn't.
                fd2 = os.dup(fd)
            except OSError as e:
                if e.errno != errno.EBADF:
                    raise
            else:
                os.close(fd2)
                count += 1
    finally:
        if old_modes is not None:
            for report_type in (msvcrt.CRT_WARN,
                                msvcrt.CRT_ERROR,
                                msvcrt.CRT_ASSERT):
                msvcrt.CrtSetReportMode(report_type, old_modes[report_type])

    return count


class SaveSignals:
    """
    Save an restore signal handlers.

    This class is only able to save/restore signal handlers registered
    by the Python signal module: see bpo-13285 for "external" signal
    handlers.
    """

    def __init__(self):
        import signal
        self.signal = signal
        self.signals = list(range(1, signal.NSIG))
        # SIGKILL and SIGSTOP signals cannot be ignored nor catched
        for signame in ('SIGKILL', 'SIGSTOP'):
            try:
                signum = getattr(signal, signame)
            except AttributeError:
                continue
            self.signals.remove(signum)
        self.handlers = {}

    def save(self):
        for signum in self.signals:
            handler = self.signal.getsignal(signum)
            if handler is None:
                # getsignal() returns None if a signal handler was not
                # registered by the Python signal module,
                # and the handler is not SIG_DFL nor SIG_IGN.
                #
                # Ignore the signal: we cannot restore the handler.
                continue
            self.handlers[signum] = handler

    def restore(self):
        for signum, handler in self.handlers.items():
            self.signal.signal(signum, handler)
support/__init__.pyo000064400000211541150327172240010557 0ustar00�
{fc=@s�
dZedkr!ed��nddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZyddlZWnek
r:dZnXddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d4d<d=d>d?d@g=ZdAZdefdB��YZdefdC��YZdefdD��YZdejfdE��YZ ej!e"dF��Z#e$dG�Z%dH�Z&dI�Z'd�d�e$dJ�Z(dK�Z)dLZ*dZ+dMa,dMa-e$Z.da/dN�Z0dO�Z1dP�Z2dQ�Z3e
jj4dR�r+e$dS�Z5dT�Z6dU�Z7dV�Z8nej9Z6ej:Z7dW�Z8dX�Z9dY�Z:dZ�Z;d[�Z<d\�Z=d]�Z>dd^�Z?d_�Z@d`ZAdaZBejCejDdb�ZEeAdc�ZFdd�ZGeG�ZHde�ZIdfZJdg�ZKd�ZLd�ZMe
jj4dk�ZNyeOe"ZPWneQk
r-e$ZPnXejRePdl�ZSdm�ZTdZUePrx�eVdn�eVdo�eVdp�eVdq�eVdr�eVds�eVdt�eVdu�eVdv�eVdw�eVdx�fD]XZWy7eWjXe
jY��jZe
jY��eWkr�e[�nWne[k
rq�XeWZUPq�Wnej\dkkr6dyZ]n�ej\dzkrNd{Z]n�d|Z]ePr�e^d}eO�rrd~Z_neOd~d�Z_e
jY�Z`eae
d��s�e
jb�d�d�kr�dZcq�edd��ZcyecjXd��Wneek
r�q�Xd�ecGHnd�jfe]ejg��Z]d�Zheji�Zjej!de$d���Zkej!e$d���Zlej!d�e$d���Zmejnjoejnjpeq��Zrejnjoer�Zsejnjtesd��Zudd��Zvd��Zwd��Zxd}ddd��Zydd��Zzd�e{fd���YZ|e$d��Z}ej!d���Z~ej!d���Zd&e{fd���YZ�d'ej�fd���YZ�d�e{fd���YZ�d*e{fd���YZ�ej!dAd�d���Z�ej!d���Z�d��Z�d��Z�d��Z�d��Z�d�Z�eae
d��r�d�e�Z�ne�d�Z�d��Z�d��Z�d�Z�d�Z�d��Z�d��Z�d��Z�d�Z�die�Z�d�e�Z�dhe�Z�e
j�Z�d��Z�d�e�d��Z�d�e�e"d��Z�d��Z�d0d�d���YZ�d��Z�d��Z�d��Z�dd��Z�d��Z�d��Z�d��Z�d��Z�da�da�d��Z�d��Z�d��Z�d��Z�e�d�e$�pW	e
jd�kpW	ej�d��Z�ejRe�d��Z�dd��Z�e$Z�d��Z�d��Z�d��Z�ej!d�d���Z�d��Z�ej!dd���Z�ej!d���Z�ej!d���Z�d��Z�ej�eae
d��d��Z�d��Z�d��Z�d�d��Z�ej!d���Z�d��Z�d@d�d���YZ�d��Z�d��Z�d�d�d���YZ�dS(�s7Supporting definitions for the Python regression tests.stest.supports3test.support must be imported from the test packagei����NtErrort
TestFailedt
TestDidNotRuntResourceDeniedt
import_moduletverboset
use_resourcest
max_memusetrecord_original_stdouttget_original_stdouttunloadtunlinktrmtreetforgettis_resource_enabledtrequirestrequires_mac_vertfind_unused_portt	bind_porttfcmpthave_unicodet	is_jythontTESTFNtHOSTtFUZZtSAVEDCWDttemp_cwdtfindfiletsortdicttcheck_syntax_errortopen_urlresourcetcheck_warningstcheck_py3k_warningstCleanImporttEnvironmentVarGuardtcaptured_outputtcaptured_stdouttTransientResourcettransient_internettrun_with_localetset_memlimitt
bigmemtesttbigaddrspacetesttBasicTestRunnertrun_unittesttrun_doctesttthreading_setuptthreading_cleanuptreap_threadst
start_threadstcpython_onlytcheck_impl_detailt
get_attributet
py3k_bytestimport_fresh_modulet
reap_childrentstrip_python_stderrtIPV6_ENABLEDtrun_with_tztSuppressCrashReportg>@cBseZdZRS(s*Base class for regression test exceptions.(t__name__t
__module__t__doc__(((s-/usr/lib64/python2.7/test/support/__init__.pyR4scBseZdZRS(sTest failed.(R<R=R>(((s-/usr/lib64/python2.7/test/support/__init__.pyR7scBseZdZRS(sTest did not run any subtests.(R<R=R>(((s-/usr/lib64/python2.7/test/support/__init__.pyR:scBseZdZRS(s�Test skipped because it requested a disallowed resource.

    This is raised when a test calls requires() for a resource that
    has not been enabled.  It is used to distinguish between expected
    and unexpected skips.
    (R<R=R>(((s-/usr/lib64/python2.7/test/support/__init__.pyR=sccs=|r4tj��tjddt�dVWdQXndVdS(s�Context manager to suppress package and module deprecation
    warnings when importing them.

    If ignore is False, this context manager has no effect.tignores.+ (module|package)N(twarningstcatch_warningstfilterwarningstDeprecationWarning(R?((s-/usr/lib64/python2.7/test/support/__init__.pyt_ignore_deprecated_importsEs
c	CsSt|��Aytj|�SWn(tk
rH}tjt|���nXWdQXdS(s�Import and return the module to be tested, raising SkipTest if
    it is not available.

    If deprecated is True, any module or package deprecation messages
    will be suppressed.N(RDt	importlibRtImportErrortunittesttSkipTesttstr(tnamet
deprecatedtmsg((s-/usr/lib64/python2.7/test/support/__init__.pyRTs

cCs�|tjkr&t|�tj|=nxTttj�D]C}||ks[|j|d�r6tj|||<tj|=q6q6WdS(swHelper function to save and remove a module from sys.modules

       Raise ImportError if the module can't be imported.t.N(tsystmodulest
__import__tlistt
startswith(RJtorig_modulestmodname((s-/usr/lib64/python2.7/test/support/__init__.pyt_save_and_remove_moduleas

cCsFt}ytj|||<Wntk
r4t}nXdtj|<|S(s�Helper function to save and block a module in sys.modules

       Return True if the module was in sys.modules, False otherwise.N(tTrueRNROtKeyErrortFalsetNone(RJRStsaved((s-/usr/lib64/python2.7/test/support/__init__.pyt_save_and_block_modulens


cCs�t|���i}g}t||�zyax|D]}t||�q3Wx-|D]%}t||�sQ|j|�qQqQWtj|�}Wntk
r�d}nXWdx'|j�D]\}	}
|
t	j
|	<q�Wx|D]}t	j
|=q�WX|SWdQXdS(sImports and returns a module, deliberately bypassing the sys.modules cache
    and importing a fresh copy of the module. Once the import is complete,
    the sys.modules cache is restored to its original state.

    Modules named in fresh are also imported anew if needed by the import.
    If one of these modules can't be imported, None is returned.

    Importing of modules named in blocked is prevented while the fresh import
    takes place.

    If deprecated is True, any module or package deprecation messages
    will be suppressed.N(RDRUR[tappendRERRFRYtitemsRNRO(RJtfreshtblockedRKRStnames_to_removet
fresh_nametblocked_nametfresh_modulet	orig_nametmoduletname_to_remove((s-/usr/lib64/python2.7/test/support/__init__.pyR6{s&





cCs�yt||�}Wn�tk
r�t|tj�rKd|j|f}n�t|tj�rsd|j|f}nit|tj�r�d|jj|f}n>t|t	�r�d|j|f}ndt	|�j|f}t
j|��nX|SdS(s?Get an attribute, raising SkipTest if AttributeError is raised.smodule %r has no attribute %rsclass %s has no attribute %rs%s instance has no attribute %rs"type object %r has no attribute %rs%r object has no attribute %rN(tgetattrtAttributeErrort
isinstancettypest
ModuleTypeR<t	ClassTypetInstanceTypet	__class__ttypeRGRH(tobjRJt	attributeRL((s-/usr/lib64/python2.7/test/support/__init__.pyR4�s
iicCs
|adS(N(t_original_stdout(tstdout((s-/usr/lib64/python2.7/test/support/__init__.pyR�scCs
tptjS(N(RrRNRs(((s-/usr/lib64/python2.7/test/support/__init__.pyR	�scCs&ytj|=Wntk
r!nXdS(N(RNRORW(RJ((s-/usr/lib64/python2.7/test/support/__init__.pyR
�s
cGsxy||�SWnctk
rs}tdkrVd|jj|fGHd|j|fGHntj|tj�||�SXdS(Nis%s: %ssre-run %s%r(tEnvironmentErrorRRnR<tostchmodtstattS_IRWXU(tpathtfunctargsterr((s-/usr/lib64/python2.7/test/support/__init__.pyt
_force_run�stwincCs�||�|r|}n$tjj|�\}}|p:d}d}xR|dkr�tj|�}|rm|n	||ks}dStj|�|d9}qFWtjd|tdd�dS(NRMg����MbP?g�?is)tests may fail, delete still pending for t
stackleveli(	RuRytsplittlistdirttimetsleepR@twarntRuntimeWarning(RztpathnametwaitalltdirnameRJttimeouttL((s-/usr/lib64/python2.7/test/support/__init__.pyt_waitfor�s
	

cCsttj|�dS(N(R�RuR(tfilename((s-/usr/lib64/python2.7/test/support/__init__.pyt_unlink�scCsttj|�dS(N(R�Rutrmdir(R�((s-/usr/lib64/python2.7/test/support/__init__.pyt_rmdir�scs6�fd��t�|dt�td�|�dS(Ncs�x�t|tj|�D]i}tjj||�}tjj|�rlt�|dt�t|tj|�qt|tj	|�qWdS(NR�(
R}RuR�RytjointisdirR�RVR�R(RyRJtfullname(t
_rmtree_inner(s-/usr/lib64/python2.7/test/support/__init__.pyR�sR�cSst|tj|�S(N(R}RuR�(tp((s-/usr/lib64/python2.7/test/support/__init__.pyt<lambda>	t(R�RV(Ry((R�s-/usr/lib64/python2.7/test/support/__init__.pyt_rmtree�scsSytj|�dSWntk
r(nX�fd���|�tj|�dS(Ncs�x�t|tj|�D]�}tjj||�}ytj|�j}Wntk
r`d}nXtj	|�r��|�t|tj
|�qt|tj|�qWdS(Ni(R}RuR�RyR�tlstattst_modeRtRwtS_ISDIRR�R(RyRJR�tmode(R�(s-/usr/lib64/python2.7/test/support/__init__.pyR�s


(tshutilRRtRuR�(Ry((R�s-/usr/lib64/python2.7/test/support/__init__.pyR�s


cCsIyt|�Wn4tk
rD}|jtjtjfkrE�qEnXdS(N(R�tOSErrorterrnotENOENTtENOTDIR(R�texc((s-/usr/lib64/python2.7/test/support/__init__.pyR$s
cCs@yt|�Wn+tk
r;}|jtjkr<�q<nXdS(N(R�R�R�R�(R�terror((s-/usr/lib64/python2.7/test/support/__init__.pyR�+s
cCsIyt|�Wn4tk
rD}|jtjtjfkrE�qEnXdS(N(R�R�R�R�tESRCH(Ryte((s-/usr/lib64/python2.7/test/support/__init__.pyR3s
cCsjt|�xYtjD]N}ttjj||tjd��ttjj||tjd��qWdS(sm"Forget" a module was ever imported by removing it from sys.modules and
    deleting any .pyc and .pyo files.tpyctpyoN(R
RNRyRRuR�textsep(RTR�((s-/usr/lib64/python2.7/test/support/__init__.pyR
;s
$cs�ttd�rtjSd}tjjd�r ddl�ddl�d}d}d�j	f�fd��Y}�j
j}|j�}|s��j
��n|�}�jj�}|j||�j|��j|��j|��}|s�j
��nt|j|@�s�d}q�n�tjdkr�dd	lm}	m�m}
m	}dd
lm}|	j|d��}
|
j�dkr�d
}q�d|f�fd��Y}|�}|
|�}|
j|�dks�|
j|�dkr�d}q�n|s�y;ddlm}|�}|j �|j!�|j"�Wq�t#k
r�}t$|�}t%|�dkrz|d d}ndj&t'|�j(|�}q�Xn|t_)|t_tjS(NtresultR~i����itUSEROBJECTFLAGScs;eZd�jjfd�jjfd�jjfgZRS(tfInheritt	fReservedtdwFlags(R<R=twintypestBOOLtDWORDt_fields_((tctypes(s-/usr/lib64/python2.7/test/support/__init__.pyR�Rss,gui not available (WSF_VISIBLE flag not set)tdarwin(tcdlltc_inttpointert	Structure(tfind_librarytApplicationServicesis0gui tests cannot run without OS X window managertProcessSerialNumbercs eZd�fd�fgZRS(t
highLongOfPSNtlowLongOfPSN(R<R=R�((R�(s-/usr/lib64/python2.7/test/support/__init__.pyR�ts	s#cannot run without OS X gui process(tTki2s [...]sTk unavailable due to {}: {}(*thasattrt_is_gui_availableR�RYRNtplatformRRR�tctypes.wintypesR�twindlltuser32tGetProcessWindowStationtWinErrorR�R�tGetUserObjectInformationWtbyreftsizeoftboolR�R�R�R�tctypes.utilR�tLoadLibrarytCGMainDisplayIDtGetCurrentProcesstSetFrontProcesstTkinterR�twithdrawtupdatetdestroyt	ExceptionRItlentformatRoR<treason(R�t	UOI_FLAGStWSF_VISIBLER�tdllthtuoftneededtresR�R�R�R�tapp_servicesR�tpsntpsn_pR�trootR�t
err_string((R�R�s-/usr/lib64/python2.7/test/support/__init__.pyR�Gsh		"			

	
cCstdkp|tkS(s�Test whether a resource is enabled.

    Known resources are set by regrtest.py.  If not running under regrtest.py,
    all resources are assumed enabled unless use_resources has been set.
    N(RRY(tresource((s-/usr/lib64/python2.7/test/support/__init__.pyR�scCs`t|�s4|dkr%d|}nt|��n|dkr\t�r\ttj��ndS(s@Raise ResourceDenied if the specified resource is not available.s$Use of the `%s' resource not enabledtguiN(RRYRR�R�(R�RL((s-/usr/lib64/python2.7/test/support/__init__.pyR�s
cs�fd�}|S(s�Decorator raising SkipTest if the OS is Mac OS X and the OS X
    version if less than min_version.

    For example, @requires_mac_ver(10, 5) raises SkipTest if the OS X version
    is lesser than 10.5.
    cs.tj����fd��}�|_|S(Ncs�tjdkr�tj�d}y"ttt|jd���}Wntk
rTq�X|�kr�djtt	���}t
jd||f��q�n�||�S(NR�iRMs&Mac OS X %s or higher required, not %s(RNR�tmac_verttupletmaptintR�t
ValueErrorR�RIRGRH(R{tkwtversion_txttversiontmin_version_txt(Rztmin_version(s-/usr/lib64/python2.7/test/support/__init__.pytwrapper�s"
(t	functoolstwrapsR�(RzR�(R�(Rzs-/usr/lib64/python2.7/test/support/__init__.pyt	decorator�s!	((R�R�((R�s-/usr/lib64/python2.7/test/support/__init__.pyR�ss	127.0.0.1s::1cCs/tj||�}t|�}|j�~|S(s�
Returns an unused port that should be suitable for binding.  This is
    achieved by creating a temporary socket with the same family and type as
    the 'sock' parameter (default is AF_INET, SOCK_STREAM), and binding it to
    the specified host address (defaults to 0.0.0.0) with the port set to 0,
    eliciting an unused ephemeral port from the OS.  The temporary socket is
    then closed and deleted, and the ephemeral port is returned.

    Either this method or bind_port() should be used for any tests where a
    server socket needs to be bound to a particular port for the duration of
    the test.  Which one to use depends on whether the calling code is creating
    a python socket, or if an unused port needs to be provided in a constructor
    or passed to an external program (i.e. the -accept argument to openssl's
    s_server mode).  Always prefer bind_port() over find_unused_port() where
    possible.  Hard coded ports should *NEVER* be used.  As soon as a server
    socket is bound to a hard coded port, the ability to run multiple instances
    of the test simultaneously on the same host is compromised, which makes the
    test a ticking time bomb in a buildbot environment. On Unix buildbots, this
    may simply manifest as a failed test, which can be recovered from without
    intervention in most cases, but on Windows, the entire python process can
    completely and utterly wedge, requiring someone to log in to the buildbot
    and manually kill the affected process.

    (This is easy to reproduce on Windows, unfortunately, and can be traced to
    the SO_REUSEADDR socket option having different semantics on Windows versus
    Unix/Linux.  On Unix, you can't have two AF_INET SOCK_STREAM sockets bind,
    listen and then accept connections on identical host/ports.  An EADDRINUSE
    socket.error will be raised at some point (depending on the platform and
    the order bind and listen were called on each socket).

    However, on Windows, if SO_REUSEADDR is set on the sockets, no EADDRINUSE
    will ever be raised when attempting to bind two identical host/ports. When
    accept() is called on each socket, the second caller's process will steal
    the port from the first caller, leaving them both in an awkwardly wedged
    state where they'll no longer respond to any signals or graceful kills, and
    must be forcibly killed via OpenProcess()/TerminateProcess().

    The solution on Windows is to use the SO_EXCLUSIVEADDRUSE socket option
    instead of SO_REUSEADDR, which effectively affords the same semantics as
    SO_REUSEADDR on Unix.  Given the propensity of Unix developers in the Open
    Source world compared to Windows ones, this is a common mistake.  A quick
    look over OpenSSL's 0.9.8g source shows that they use SO_REUSEADDR when
    openssl.exe is called with the 's_server' option, for example. See
    http://bugs.python.org/issue2550 for more info.  The following site also
    has a very thorough description about the implications of both REUSEADDR
    and EXCLUSIVEADDRUSE on Windows:
    http://msdn2.microsoft.com/en-us/library/ms740621(VS.85).aspx)

    XXX: although this approach is a vast improvement on previous attempts to
    elicit unused ports, it rests heavily on the assumption that the ephemeral
    port returned to us by the OS won't immediately be dished back out to some
    other process when we close and delete our temporary socket but before our
    calling code has a chance to bind the returned port.  We can deal with this
    issue if/when we come across it.(tsocketRtclose(tfamilytsocktypettempsocktport((s-/usr/lib64/python2.7/test/support/__init__.pyR�s
6
cCs|jtjkr�|jtjkr�ttd�rc|jtjtj�dkrct	d��qcnttd�r�y1|jtjtj
�dkr�t	d��nWq�tk
r�q�Xnttd�r�|jtjtj
d�q�n|j|df�|j�d}|S(s%Bind the socket to a free port and return the port number.  Relies on
    ephemeral ports in order to ensure we are using an unbound port.  This is
    important as many tests may be running simultaneously, especially in a
    buildbot environment.  This method raises an exception if the sock.family
    is AF_INET and sock.type is SOCK_STREAM, *and* the socket has SO_REUSEADDR
    or SO_REUSEPORT set on it.  Tests should *never* set these socket options
    for TCP/IP sockets.  The only case for setting these options is testing
    multicasting via multiple UDP sockets.

    Additionally, if the SO_EXCLUSIVEADDRUSE socket option is available (i.e.
    on Windows), it will be set on the socket.  This will prevent anyone else
    from bind()'ing to our host/port for the duration of the test.
    tSO_REUSEADDRisHtests should never set the SO_REUSEADDR socket option on TCP/IP sockets!tSO_REUSEPORTsHtests should never set the SO_REUSEPORT socket option on TCP/IP sockets!tSO_EXCLUSIVEADDRUSEi(R�R�tAF_INETRotSOCK_STREAMR�t
getsockoptt
SOL_SOCKETR�RR�Rtt
setsockoptR�tbindtgetsockname(tsockthostR�((s-/usr/lib64/python2.7/test/support/__init__.pyRs$
cCs{tjrwd}zNy3tjtjtj�}|jtdf�tSWntjk
r[nXWd|rs|j	�nXnt
S(s+Check whether IPv6 is enabled on this host.iN(R�thas_ipv6RYtAF_INET6R�RtHOSTv6RVR�R�RX(R((s-/usr/lib64/python2.7/test/support/__init__.pyt_is_ipv6_enabled$s	cs"tj���fd��}|S(s5Skip the test on TLS certificate validation failures.csRy�||�Wn:tk
rM}dt|�krGtjd��n�nXdS(NtCERTIFICATE_VERIFY_FAILEDs.system does not contain necessary certificates(tIOErrorRIRGRH(R{tkwargsR�(tf(s-/usr/lib64/python2.7/test/support/__init__.pytdec7s(R�R�(RR((Rs-/usr/lib64/python2.7/test/support/__init__.pytsystem_must_validate_cert5s	g���ư>cCs#t|t�st|t�rcy8t|�t|�t}t||�|krUdSWqqXn�t|�t|�krt|ttf�rxPttt	|�t	|���D]-}t
||||�}|dkr�|Sq�Wt	|�t	|�kt	|�t	|�kS||k||kS(Ni(RitfloattabsRRoR�RQtrangetminR�R(txtytfuzztitoutcome((s-/usr/lib64/python2.7/test/support/__init__.pyRDs-(,iiitjavasno unicode supportcCs
t|d�S(Nsunicode-escape(tunicode(ts((s-/usr/lib64/python2.7/test/support/__init__.pytumsi�i0iAi�ii�ii*ii�i� s$testtriscosttestfiles@testR�s@test-��slatin-1tgetwindowsversioniis'u"@test-\u5171\u6709\u3055\u308c\u308b"tLatin1sgWARNING: The filename %r CAN be encoded by the filesystem.  Unicode filename tests may not be effectives	{}_{}_tmpshttp://www.pythontest.netccsQt}|dkrEddl}|j�}t}tjj|�}n�tr�t	|t
�r�tjjr�y|jt
j�pd�}Wq�tk
r�|s�tjd��q�q�Xnytj|�t}Wn7tk
r|s��ntjd|tdd�nX|rtj�}nz	|VWd|rL|tj�krLt|�nXdS(s�Return a context manager that creates a temporary directory.

    Arguments:

      path: the directory to create temporarily.  If omitted or None,
        defaults to creating a temporary directory using tempfile.mkdtemp.

      quiet: if False (the default), the context manager raises an exception
        on error.  Otherwise, if the path is specified and cannot be
        created, only a warning is issued.

    i����Ntasciis;unable to encode the cwd name with the filesystem encoding.s+tests may fail, unable to create temp dir: Ri(RXRYttempfiletmkdtempRVRuRytrealpathRRiRtsupports_unicode_filenamestencodeRNtgetfilesystemencodingtUnicodeEncodeErrorRGRHtmkdirR�R@R�R�tgetpidR(Rytquiettdir_createdR tpid((s-/usr/lib64/python2.7/test/support/__init__.pyttemp_dir�s6





	ccs{tj�}ytj|�Wn7tk
rV|s9�ntjd|tdd�nXztj�VWdtj|�XdS(sgReturn a context manager that changes the current working directory.

    Arguments:

      path: the directory to use as the temporary current working directory.

      quiet: if False (the default), the context manager raises an exception
        on error.  Otherwise, it issues only a warning and keeps the current
        working directory the same.

    s)tests may fail, unable to change CWD to: RiN(RutgetcwdtchdirR�R@R�R�(RyR)t	saved_dir((s-/usr/lib64/python2.7/test/support/__init__.pyt
change_cwds


ttempcwdc	csBtd|d|��'}t|d|��}|VWdQXWdQXdS(s�
    Context manager that temporarily creates and changes the CWD.

    The function temporarily changes the current working directory
    after creating a temporary directory in the current directory with
    name *name*.  If *name* is None, the temporary directory is
    created using tempfile.mkdtemp.

    If *quiet* is False (default) and it is not possible to
    create or change the CWD, an error is raised.  If *quiet* is True,
    only a warning is raised and the original CWD is used.

    RyR)N(R,R0(RJR)t	temp_pathtcwd_dir((s-/usr/lib64/python2.7/test/support/__init__.pyR&stdatacCs�tjj|�r|S|dk	r:tjj||�}ntgtj}x9|D]1}tjj||�}tjj|�rQ|SqQW|S(s�Try to find a file on sys.path and the working directory.  If it is not
    found the argument passed to the function is returned (this does not
    necessarily signal failure; could still be the legitimate path).N(RuRytisabsRYR�t
TEST_HOME_DIRRNtexists(tfiletsubdirRytdntfn((s-/usr/lib64/python2.7/test/support/__init__.pyRAs
cCsJ|j�}|j�g|D]}d|^q}dj|�}d|S(s%Like repr(dict), but in sorted order.s%r: %rs, s{%s}(R]tsortR�(tdictR]tpairt	reprpairst
withcommas((s-/usr/lib64/python2.7/test/support/__init__.pyROs

cCs9ttd�}z|j�SWd|j�tt�XdS(s`
    Create an invalid file descriptor by opening and closing a file and return
    its fd.
    twbN(topenRtfilenoR�R(R8((s-/usr/lib64/python2.7/test/support/__init__.pytmake_bad_fdWs

cCs||jt|��}t|dd�WdQX|j}|dk	rV|j|j|�n|dk	rx|j|j|�ndS(Ns
<test string>texec(tassertRaisesRegexptSyntaxErrortcompilet	exceptionRYtassertEqualtlinenotoffset(ttestcaset	statementterrtextRKRLtcmR|((s-/usr/lib64/python2.7/test/support/__init__.pyRcs	c
sSddl}ddl}|j|�djd�d}tjjt|�}�fd�}tjj|�r�||�}|dk	r�|St	|�nt
d�t�d|IJ|j|dd�}zNt
|d	��9}|j�}	x#|	r
|j|	�|j�}	q�WWdQXWd|j�X||�}|dk	r?|Std
|��dS(Ni����it/csGt|�}�dkr|S�|�r9|jd�|S|j�dS(Ni(RBRYtseekR�(R;R(tcheck(s-/usr/lib64/python2.7/test/support/__init__.pytcheck_valid_filess
turlfetchs	fetching %s ...R�iRAsinvalid resource "%s"(turlparseturllib2R�RuRyR�t
TEST_DATA_DIRR7RYRRR	turlopenRBtreadtwriteR�R(
turlRSRVRWR�R;RTRtoutR((RSs-/usr/lib64/python2.7/test/support/__init__.pyRls. 	

	
tWarningsRecordercBs8eZdZd�Zd�Zed��Zd�ZRS(syConvenience wrapper for the warnings list returned on
       entry to the warnings.catch_warnings() context manager.
    cCs||_d|_dS(Ni(t	_warningst_last(tselft
warnings_list((s-/usr/lib64/python2.7/test/support/__init__.pyt__init__�s	cCs\t|j�|jkr,t|jd|�S|tjjkrBdStd||f��dS(Ni����s%r has no attribute %r(	R�R_R`RgR@tWarningMessaget_WARNING_DETAILSRYRh(Ratattr((s-/usr/lib64/python2.7/test/support/__init__.pyt__getattr__�s
cCs|j|jS(N(R_R`(Ra((s-/usr/lib64/python2.7/test/support/__init__.pyR@�scCst|j�|_dS(N(R�R_R`(Ra((s-/usr/lib64/python2.7/test/support/__init__.pytreset�s(R<R=R>RcRgtpropertyR@Rh(((s-/usr/lib64/python2.7/test/support/__init__.pyR^�s
		c
csptjd�}|jjd�}|r4|j�ntjdt��&}tjdj	d�t
|�VWdQXg|D]}|j^qu}g}x�|D]�\}}	t}
x[|D]R}t
|�}tj||tj�r�t|j|	�r�t}
|j|�q�q�W|
r�|r�|j||	jf�q�q�W|rOtd|d��n|rltd	|d��ndS(
s�Catch the warnings, then check if all the expected
    warnings have been raised and re-raise unexpected warnings.
    If 'quiet' is True, only re-raise the unexpected warnings.
    it__warningregistry__trecordR@talwaysNsunhandled warning %ris)filter (%r, %s) did not catch any warning(RNt	_getframet	f_globalstgettclearR@RARVROtsimplefilterR^tmessageRXRItretmatchtIt
issubclassRntremoveR\R<tAssertionError(
tfiltersR)tframetregistrytwtwarningtreraisetmissingRLtcattseenR�Rr((s-/usr/lib64/python2.7/test/support/__init__.pyt_filterwarnings�s0
cOsI|jd�}|s<dtff}|dkr<t}q<nt||�S(s�Context manager to silence warnings.

    Accept 2-tuples as positional arguments:
        ("message regexp", WarningCategory)

    Optional argument:
     - if 'quiet' is True, it does not fail if a filter catches nothing
        (default True without argument,
         default False if some filters are defined)

    Without argument, it defaults to:
        check_warnings(("", Warning), quiet=True)
    R)R�N(RotWarningRYRVR�(RyR
R)((s-/usr/lib64/python2.7/test/support/__init__.pyR�scOs@tjr$|s*dtff}q*nd}t||jd��S(sjContext manager to silence py3k warnings.

    Accept 2-tuples as positional arguments:
        ("message regexp", WarningCategory)

    Optional argument:
     - if 'quiet' is True, it does not fail if a filter catches nothing
        (default False)

    Without argument, it defaults to:
        check_py3k_warnings(("", DeprecationWarning), quiet=False)
    R�R)((RNtpy3kwarningRCR�Ro(RyR
((s-/usr/lib64/python2.7/test/support/__init__.pyR �s
	cBs)eZdZd�Zd�Zd�ZRS(s,Context manager to force import to return a new module reference.

    This is useful for testing module-level behaviours, such as
    the emission of a DeprecationWarning on import.

    Use like this:

        with CleanImport("foo"):
            importlib.import_module("foo") # new reference
    cGsotjj�|_xV|D]N}|tjkrtj|}|j|krZtj|j=ntj|=qqWdS(N(RNROtcopytoriginal_modulesR<(Ratmodule_namestmodule_nameRe((s-/usr/lib64/python2.7/test/support/__init__.pyRcs

cCs|S(N((Ra((s-/usr/lib64/python2.7/test/support/__init__.pyt	__enter__scGstjj|j�dS(N(RNROR�R�(Rat
ignore_exc((s-/usr/lib64/python2.7/test/support/__init__.pyt__exit__s(R<R=R>RcR�R�(((s-/usr/lib64/python2.7/test/support/__init__.pyR!s
	
	cBs_eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
s_Class to help protect the environment variable properly.  Can be used as
    a context manager.cCstj|_i|_dS(N(Rutenviront_environt_changed(Ra((s-/usr/lib64/python2.7/test/support/__init__.pyRc(scCs|j|S(N(R�(Ratenvvar((s-/usr/lib64/python2.7/test/support/__init__.pyt__getitem__,scCs<||jkr+|jj|�|j|<n||j|<dS(N(R�R�Ro(RaR�tvalue((s-/usr/lib64/python2.7/test/support/__init__.pyt__setitem__/scCsK||jkr+|jj|�|j|<n||jkrG|j|=ndS(N(R�R�Ro(RaR�((s-/usr/lib64/python2.7/test/support/__init__.pyt__delitem__5scCs
|jj�S(N(R�tkeys(Ra((s-/usr/lib64/python2.7/test/support/__init__.pyR�<scCs|||<dS(N((RaR�R�((s-/usr/lib64/python2.7/test/support/__init__.pytset?scCs||=dS(N((RaR�((s-/usr/lib64/python2.7/test/support/__init__.pytunsetBscCs|S(N((Ra((s-/usr/lib64/python2.7/test/support/__init__.pyR�EscGshxU|jj�D]D\}}|dkrG||jkrT|j|=qTq||j|<qW|jt_dS(N(R�R]RYR�RuR�(RaR�tktv((s-/usr/lib64/python2.7/test/support/__init__.pyR�Hs(R<R=R>RcR�R�R�R�R�R�R�R�(((s-/usr/lib64/python2.7/test/support/__init__.pyR"#s								t
DirsOnSysPathcBs)eZdZd�Zd�Zd�ZRS(s�Context manager to temporarily add directories to sys.path.

    This makes a copy of sys.path, appends any directories given
    as positional arguments, then reverts sys.path to the copied
    settings when the context ends.

    Note that *all* sys.path modifications in the body of the
    context manager, including replacement of the object,
    will be reverted at the end of the block.
    cGs-tj|_tj|_tjj|�dS(N(RNRytoriginal_valuetoriginal_objecttextend(Ratpaths((s-/usr/lib64/python2.7/test/support/__init__.pyRc^s
cCs|S(N((Ra((s-/usr/lib64/python2.7/test/support/__init__.pyR�cscGs|jt_|jtj(dS(N(R�RNRyR�(RaR�((s-/usr/lib64/python2.7/test/support/__init__.pyR�fs(R<R=R>RcR�R�(((s-/usr/lib64/python2.7/test/support/__init__.pyR�Rs
		cBs2eZdZd�Zd�Zdddd�ZRS(s�Raise ResourceDenied if an exception is raised while the context manager
    is in effect that matches the specified exception and attributes.cKs||_||_dS(N(R�tattrs(RaR�R
((s-/usr/lib64/python2.7/test/support/__init__.pyRcps	cCs|S(N((Ra((s-/usr/lib64/python2.7/test/support/__init__.pyR�tscCs}|dk	ryt|j|�ryxX|jj�D]8\}}t||�sMPnt||�|kr.Pq.q.Wtd��ndS(s�If type_ is a subclass of self.exc and value has attributes matching
        self.attrs, raise ResourceDenied.  Otherwise let the exception
        propagate (if any).s%an optional resource is not availableN(RYRvR�R�t	iteritemsR�RgR(Rattype_R�t	tracebackRft
attr_value((s-/usr/lib64/python2.7/test/support/__init__.pyR�wsN(R<R=R>RcR�RYR�(((s-/usr/lib64/python2.7/test/support/__init__.pyR%ks		c#s�dddd d!d"g}d#d$d%d&d'g}td|��|�g��s�g|D]\}}tt||�^qV�g|D]\}}tt||�^q��n���fd�}tj�}z�y%|dk	r�tj|�ndVWn�tk
r�}	xxtr}|	j	}
t
|
�dkrGt|
dt�rG|
d}	qt
|
�dkryt|
dt�ry|
d}	qPqW||	��nXWdtj|�XdS((s�Return a context manager that raises ResourceDenied when various issues
    with the Internet connection manifest themselves as exceptions.tECONNREFUSEDiot
ECONNRESETihtEHOSTUNREACHiqtENETUNREACHiet	ETIMEDOUTint
EADDRNOTAVAILict	EAI_AGAINi����tEAI_FAILi����t
EAI_NONAMEi����t
EAI_NODATAi����t
WSANO_DATAi�*sResource '%s' is not availablecst|dd�}t|tj�sNt|tj�rB|�ksN|�kr{tsrtjj	�j
dd�n��ndS(NR�is
(RgRYRiR�R�tgaierrorRRNtstderrR[R{(R|tn(tcaptured_errnostdeniedt
gai_errnos(s-/usr/lib64/python2.7/test/support/__init__.pytfilter_error�sNiii(R�io(R�ih(R�iq(R�ie(R�in(R�ic(R�i����(R�i����(R�i����(R�i����(R�i�*(RRgR�R�tgetdefaulttimeoutRYtsetdefaulttimeoutR	RVR{R�Ri(t
resource_nameR�terrnostdefault_errnostdefault_gai_errnosRJtnumR�told_timeoutR|ta((R�R�R�s-/usr/lib64/python2.7/test/support/__init__.pyR&�sJ		(+				%
%

ccs[ddl}tt|�}tt||j��ztt|�VWdtt||�XdS(s�Return a context manager used by captured_stdout and captured_stdin
    that temporarily replaces the sys stream *stream_name* with a StringIO.i����N(tStringIORgRNtsetattr(tstream_nameR�torig_stdout((s-/usr/lib64/python2.7/test/support/__init__.pyR#�scCs
td�S(s�Capture the output of sys.stdout:

       with captured_stdout() as s:
           print "hello"
       self.assertEqual(s.getvalue(), "hello")
    Rs(R#(((s-/usr/lib64/python2.7/test/support/__init__.pyR$�scCs
td�S(NR�(R#(((s-/usr/lib64/python2.7/test/support/__init__.pytcaptured_stderr�scCs
td�S(Ntstdin(R#(((s-/usr/lib64/python2.7/test/support/__init__.pytcaptured_stdin�scCs8tj�tr tjd�ntj�tj�dS(s�Force as many objects as possible to be collected.

    In non-CPython implementations of Python, this is needed because timely
    deallocation is not guaranteed by the garbage collector.  (Even in CPython
    this can be the case in case of reference cycles.)  This means that __del__
    methods may be called later than expected and weakrefs may remain alive for
    longer than expected.  This function tries its best to force all garbage
    objects to disappear.
    g�������?N(tgctcollectRR�R�(((s-/usr/lib64/python2.7/test/support/__init__.pyt
gc_collect�s



t2PtgettotalrefcounttPcCstjt|d�S(Nt0P(tstructtcalcsizet_header(tfmt((s-/usr/lib64/python2.7/test/support/__init__.pytcalcobjsize�scCstjt|d�S(NR�(R�R�t_vheader(R�((s-/usr/lib64/python2.7/test/support/__init__.pytcalcvobjsize�sii	cCs�ddl}tj|�}t|�tkr:|jt@s_t|�tkrot|�jt@ro||j7}ndt|�||f}|j|||�dS(Ni����s&wrong size for %s: got %d, expected %d(	t	_testcapiRNt	getsizeofRot	__flags__t_TPFLAGS_HEAPTYPEt_TPFLAGS_HAVE_GCtSIZEOF_PYGC_HEADRJ(ttesttotsizeR�R�RL((s-/usr/lib64/python2.7/test/support/__init__.pytcheck_sizeofs%cs��fd�}|S(Ncs1���fd�}�j|_�j|_|S(Ncs�y.ddl}t|��}|j|�}Wn$tk
rD�nAd}}n1Xx-�D]%}y|j||�PWq\q\Xq\Wz�||�SWd|r�|r�|j||�nXdS(Ni����(tlocaleRgt	setlocaleRhRY(R{tkwdsR�tcategorytorig_localetloc(tcatstrRztlocales(s-/usr/lib64/python2.7/test/support/__init__.pytinners$

(t	func_nameR>(RzR�(R�R�(Rzs-/usr/lib64/python2.7/test/support/__init__.pyR�s((R�R�R�((R�R�s-/usr/lib64/python2.7/test/support/__init__.pyR'scs�fd�}|S(Ncs.��fd�}�j|_�j|_|S(Ncs�y
tj}Wn tk
r/tjd��nXdtjkrOtjd}nd}�tjd<|�z�||�SWd|dkr�tjd=n
|tjd<tj�XdS(Nstzset requiredtTZ(R�ttzsetRhRGRHRuR�RY(R{R�R�torig_tz(Rzttz(s-/usr/lib64/python2.7/test/support/__init__.pyR�;s




(R<R>(RzR�(R�(Rzs-/usr/lib64/python2.7/test/support/__init__.pyR�:s((R�R�((R�s-/usr/lib64/python2.7/test/support/__init__.pyR:9scCs�idd6td6td6dtd6}tjd|tjtjB�}|dkrgtd|f��ntt	|j
d��||j
d	�j��}|a|t
kr�t
}n|tdkr�td
|f��n|adS(NiR�tmtgtts(\d+(\.\d+)?) (K|M|G|T)b?$sInvalid memory limit %riis$Memory limit %r too low to be useful(t_1Mt_1GRsRtt
IGNORECASEtVERBOSERYR�R�Rtgrouptlowertreal_max_memusetMAX_Py_ssize_tt_2GR(tlimittsizesR�tmemlimit((s-/usr/lib64/python2.7/test/support/__init__.pyR(bs 2	ics���fd�}|S(sQDecorator for bigmem tests.

    'minsize' is the minimum useful size for the test (in arbitrary,
    test-interpreted units.) 'memuse' is the number of 'bytes per size' for
    the test, or a good estimate of it. 'overhead' specifies fixed overhead,
    independent of the testsize, and defaults to 5Mb.

    The decorator tries to guess a good value for 'size' and passes it to
    the decorated test function. If minsize * memuse is more than the
    allowed memory use (as defined by max_memuse), the test is skipped.
    Otherwise, minsize is adjusted upward to use up to max_memuse.
    cs7����fd�}�|_�|_�|_|S(Ncs�ts.d}|j|��dtk�n^tt���}|�krutrqtjjd�jf�ndSt	|dt��}�||�S(Niis)Skipping %s because of memory constraint
i2(
RtassertFalseR�R�RRNR�R[R<tmax(Ratmaxsize(Rtmemusetminsizetoverhead(s-/usr/lib64/python2.7/test/support/__init__.pyR��s"(R�R�R�(RR�(R�R�R�(Rs-/usr/lib64/python2.7/test/support/__init__.pyR��s
			((R�R�R�R�((R�R�R�s-/usr/lib64/python2.7/test/support/__init__.pyR)ws
cs����fd�}|S(Ncs7����fd�}�|_�|_�|_|S(Ncsftsd}n�}ts"�rYt|�krYtrUtjjd�jf�ndS�||�S(Nis)Skipping %s because of memory constraint
(R�RRNR�R[R<(RaR�(tdry_runRR�R�(s-/usr/lib64/python2.7/test/support/__init__.pyR��s	
(R�R�R�(RR�(RR�R�R�(Rs-/usr/lib64/python2.7/test/support/__init__.pyR��s
			((R�R�R�RR�((RR�R�R�s-/usr/lib64/python2.7/test/support/__init__.pytprecisionbigmemtest�scs�fd�}|S(s0Decorator for tests that fill the address space.cs@ttkr2tr<tjjd�jf�q<n
�|�SdS(Ns)Skipping %s because of memory constraint
(RR�RRNR�R[R<(Ra(R(s-/usr/lib64/python2.7/test/support/__init__.pyR��s
((RR�((Rs-/usr/lib64/python2.7/test/support/__init__.pyR*�scBseZd�ZRS(cCstj�}||�|S(N(RGt
TestResult(RaR�R�((s-/usr/lib64/python2.7/test/support/__init__.pytrun�s
(R<R=R(((s-/usr/lib64/python2.7/test/support/__init__.pyR+�scCs|S(N((Rp((s-/usr/lib64/python2.7/test/support/__init__.pyt_id�scCsP|dkr&t�r&tjtj�St|�r6tStjdj|��SdS(NR�sresource {0!r} is not enabled(R�RGtskipR�RRR�(R�((s-/usr/lib64/python2.7/test/support/__init__.pytrequires_resource�s
cCstdt�|�S(s9
    Decorator for tests only applicable on CPython.
    tcpython(timpl_detailRV(R�((s-/usr/lib64/python2.7/test/support/__init__.pyR2�scKs}t|�rtS|dkrpt|�\}}|r=d}nd}t|j��}|jdj|��}ntj	|�S(Ns*implementation detail not available on {0}s%implementation detail specific to {0}s or (
R3RRYt
_parse_guardstsortedR�R�R�RGR(RLtguardst
guardnamestdefault((s-/usr/lib64/python2.7/test/support/__init__.pyR�s	cCs2|sitd6tfS|j�d}||fS(NRi(RVRXtvalues(Rtis_true((s-/usr/lib64/python2.7/test/support/__init__.pyR	�scKs.t|�\}}|jtj�j�|�S(s5This function returns True or False depending on the host platform.
       Examples:
          if check_impl_detail():               # only on CPython (default)
          if check_impl_detail(jython=True):    # only on Jython
          if check_impl_detail(cpython=False):  # everywhere except on CPython
    (R	RoR�tpython_implementationR�(RR
((s-/usr/lib64/python2.7/test/support/__init__.pyR3�scCsrg}x\|jD]Q}t|tj�rEt||�|j|�q||�r|j|�qqW||_dS(s>Recursively filter test cases in a suite based on a predicate.N(t_testsRiRGt	TestSuitet
_filter_suiteR\(tsuitetpredtnewtestsR�((s-/usr/lib64/python2.7/test/support/__init__.pyR�s
cCs�tr'tjtjdddt�}n	t�}|j|�}|jr\|j	r\t
�n|j�s�t|j
�dkr�|jr�|j
dd}nLt|j�dkr�|j
r�|jdd}nd}ts�|d7}nt|��ndS(	s2Run tests from a unittest.TestSuite-derived class.t	verbosityitfailfastiismultiple errors occurreds!; run in verbose mode for detailsN(RRGtTextTestRunnerRNRsRR+RttestsRuntskippedRt
wasSuccessfulR�terrorstfailuresR(RtrunnerR�R|((s-/usr/lib64/python2.7/test/support/__init__.pyt
_run_suites 		
cCs$tdkrtSt|j��SdS(N(t_match_test_funcRYRVtid(R�((s-/usr/lib64/python2.7/test/support/__init__.pyt
match_test#scCsd|kotjd|�S(NRMs[?*\[\]](Rstsearch(tpattern((s-/usr/lib64/python2.7/test/support/__init__.pyt_is_full_match_test+scs�|tkrdS|s%d}d}nittt|��rLt|�j}nBdjttj	|��}t
j|�j��fd�}|}t
|�a|adS(Nt|cs0�|�rtStt�|jd���SdS(NRM(RVtanyR�R�(ttest_id(tregex_match(s-/usr/lib64/python2.7/test/support/__init__.pytmatch_test_regexJs((t_match_test_patternsRYtallR�R&R�t__contains__R�tfnmatcht	translateRsRHRtR�R!(tpatternsRztregexR+((R*s-/usr/lib64/python2.7/test/support/__init__.pytset_match_tests5s	cGs�tjtjf}tj�}x�|D]�}t|t�rx|tjkri|jtjtj|��q�t	d��q%t||�r�|j|�q%|jtj
|��q%Wt|t�t
|�dS(s1Run tests from unittest.TestCase-derived classes.s)str arguments must be keys in sys.modulesN(RGRtTestCaseRiRIRNROtaddTestt
findTestCasesR�t	makeSuiteRR#R (tclassestvalid_typesRtcls((s-/usr/lib64/python2.7/test/support/__init__.pyR,]s
 
Rtwin32tWITH_DOC_STRINGSstest requires docstringscCs�ddl}|dkr!t}nd}tj}t�t_z>|j|d|�\}}|rytd||f��nWd|t_Xtr�d|j|fGHn||fS(s
Run doctest on the given module.  Return (#failures, #tests).

    If optional argument verbosity is not specified (or is None), pass
    test.support's belief about verbosity on to doctest.  Else doctest's
    usual behavior is used (it searches sys.argv for -v).
    i����NRs%d of %d doctests faileds,doctest (%s) ... %d tests with zero failures(	tdoctestRYRRNRsR	ttestmodRR<(ReRR=tsave_stdoutRR�((s-/usr/lib64/python2.7/test/support/__init__.pyR-|s		
cCstrtj�fSdSdS(Ni(i(tthreadt_count(((s-/usr/lib64/python2.7/test/support/__init__.pyR.�s
cCsTts
dSd}x=t|�D]/}tj�}||kr?Pntjd�qWdS(Ni
g�������?(R@RRAR�R�(t
nb_threadst
_MAX_COUNTtcountR�((s-/usr/lib64/python2.7/test/support/__init__.pyR/�scs,ts
�Stj���fd��}|S(s�Use this function when threads are being used.  This will
    ensure that the threads are cleaned up even when the test fails.
    If threading is unavailable this function does nothing.
    cs)t�}z�|�SWdt|�XdS(N(R.R/(R{tkey(Rz(s-/usr/lib64/python2.7/test/support/__init__.pyR��s	(R@R�R�(RzR�((Rzs-/usr/lib64/python2.7/test/support/__init__.pyR0�sgN@ccs�tj�}z	dVWdtj�}||}x�tr�tj�}||krSPntj�|kr�tj�|}d|||||f}t|��ntjd�t�q1WXdS(sE
    bpo-31234: Context manager to wait until all threads created in the with
    statement exit.

    Use thread.count() to check if threads exited. Indirectly, wait until
    threads exit the internal t_bootstrap() C function of the thread module.

    threading_setup() and threading_cleanup() are designed to emit a warning
    if a test leaves running threads in the background. This context manager
    is designed to cleanup threads started by the thread.start_new_thread()
    which doesn't allow to wait for thread exit, whereas thread.Thread has a
    join() method.
    NsYwait_threads() failed to cleanup %s threads after %.1f seconds (count: %s, old count: %s)g{�G�z�?(R@RAR�RVRxR�R�(R�t	old_countt
start_timetdeadlineRDtdtRL((s-/usr/lib64/python2.7/test/support/__init__.pytwait_threads_exit�s 	
	
cCscttd�r_d}xGtr[y/tj|tj�\}}|dkrLPnWqPqXqWndS(s�Use this function at the end of test_main() whenever sub-processes
    are started.  This will help ensure that no extra children (zombies)
    stick around to hog resources and create problems when looking
    for refleaks.
    twaitpidi����iN(R�RuRVRKtWNOHANG(tany_processR+tstatus((s-/usr/lib64/python2.7/test/support/__init__.pyR7�s		c	cs�t|�}g}zfy,x%|D]}|j�|j|�qWWn.trkdt|�t|�fGHn�nXdVWd|r�|�ntj�}}x�tdd�D]�}|d7}x.|D]&}|jt|tj�d��q�Wg|D]}|j	�r�|^q�}|sPntr�dt|�|fGHq�q�WXg|D]}|j	�rE|^qE}|r�t
dt|���ndS(Ns/Can't start %d threads, only %d threads startediii<g{�G�z�?s7Unable to join %d threads during a period of %d minutessUnable to join %d threads(RQtstartR\RR�R�RR�R�tisAliveRx(tthreadstunlocktstartedR�tendtimet	starttimeR�((s-/usr/lib64/python2.7/test/support/__init__.pyR1s:

	


$%%ccs�t||�rNt||�}t|||�z	|VWdt|||�Xn<t|||�z	dVWdt||�r�t||�nXdS(s�Temporary swap out an attribute with a new object.

    Usage:
        with swap_attr(obj, "attr", 5):
            ...

        This will set obj.attr to 5 for the duration of the with: block,
        restoring the old value at the end of the block. If `attr` doesn't
        exist on `obj`, it will be created and then deleted at the end of the
        block.

        The old value (or None if it doesn't exist) will be assigned to the
        target of the "as" clause, if there is one.
    N(R�RgR�tdelattr(RpRftnew_valtreal_val((s-/usr/lib64/python2.7/test/support/__init__.pyt	swap_attr)s		ccsk||kr:||}|||<z	|VWd|||<Xn-|||<z	dVWd||krf||=nXdS(s�Temporary swap out an item with a new object.

    Usage:
        with swap_item(obj, "item", 5):
            ...

        This will set obj["item"] to 5 for the duration of the with: block,
        restoring the old value at the end of the block. If `item` doesn't
        exist on `obj`, it will be created and then deleted at the end of the
        block.

        The old value (or None if it doesn't exist) will be assigned to the
        target of the "as" clause, if there is one.
    N((RptitemRWRX((s-/usr/lib64/python2.7/test/support/__init__.pyt	swap_itemHs

	
	cCs\y|j�SWnGtk
rWydjd�|D��SWqXtk
rSt|�SXnXdS(sZEmulate the py3k bytes() constructor.

    NOTE: This is only a best effort function.
    R�css|]}t|�VqdS(N(tchr(t.0R((s-/usr/lib64/python2.7/test/support/__init__.pys	<genexpr>rsN(ttobytesRhR�t	TypeErrortbytes(tb((s-/usr/lib64/python2.7/test/support/__init__.pyR5gs

t	getcountss-types are immortal if COUNT_ALLOCS is definedcCsddl}|j�S(sZReturn a list of command-line arguments reproducing the current
    settings in sys.flags.i����N(t
subprocesst_args_from_interpreter_flags(Rc((s-/usr/lib64/python2.7/test/support/__init__.pytargs_from_interpreter_flagsyscCstjdd|�j�}|S(s�Strip the stderr of a Python process from potential debug output
    emitted by the interpreter.

    This will typically be run on the result of the communicate() method
    of a subprocess.Popen object.
    s\[\d+ refs\]\r?\n?$R�(Rstsubtstrip(R�((s-/usr/lib64/python2.7/test/support/__init__.pyR8scsid|f��fd��Y}tg�|||���|jtt��t�|j�d�dS(NtAcseZ��fd�ZRS(cs0t�d<yt��Wntk
r+nXdS(Ni(RVtnextt
StopIteration(Ra(tdonetit(s-/usr/lib64/python2.7/test/support/__init__.pyt__del__�s


(R<R=Rm((RkRl(s-/usr/lib64/python2.7/test/support/__init__.pyRh�si(RXtassertRaisesRjRiR�t
assertTrue(R�titerR:R{Rh((RkRls-/usr/lib64/python2.7/test/support/__init__.pytcheck_free_after_iterating�s	ccs:tj�}tj�z	dVWd|r5tj�nXdS(N(R�t	isenabledtdisabletenable(thave_gc((s-/usr/lib64/python2.7/test/support/__init__.pyt
disable_gc�s
	cCsTtjd�pd}d}x,|j�D]}|jd�r(|}q(q(W|dkS(s,Find if Python was built with optimizations.t	PY_CFLAGSR�s-Os-O0s-Og(R�s-O0s-Og(t	sysconfigtget_config_varR�RR(tcflagst	final_opttopt((s-/usr/lib64/python2.7/test/support/__init__.pytpython_is_optimized�s
cBs,eZdZdZdZd�Zd�ZRS(s�Try to prevent a crash report from popping up.

    On Windows, don't display the Windows Error Reporting dialog.  On UNIX,
    disable the creation of coredump file.
    cCstjjd�r�ddl}|jj|_d}|jj|�|_|jj|j|B�yddl	}|j
Wnttfk
r�qXi|_
x|j|j|jgD]C}|j
||j�}|j||j�}||f|j
|<q�Wnyddl}Wntk
r%d}nX|dk	r�y9|j|j�|_|j|jd|jdf�Wq�ttfk
r�q�Xntjdkrddl}dd	d
dg}	|j|	d|jd
|j�}
|
j�d}|j�dkrtj j!d�tj j"�qn|S(s�On Windows, disable Windows Error Reporting dialogs using
        SetErrorMode.

        On UNIX, try to save the previous core file size limit, then set
        soft limit to 0.
        R~i����NiiiR�s/usr/bin/defaultsRZscom.apple.CrashReportert
DialogTypeRsR�t	developers:this test triggers the Crash Reporter, that is intentional(#RNR�RRR�R�tkernel32t_k32tSetErrorModet	old_valueR�tCrtSetReportModeRhRFt	old_modestCRT_WARNt	CRT_ERRORt
CRT_ASSERTtCRTDBG_MODE_FILEtCrtSetReportFiletCRTDBG_FILE_STDERRR�RYt	getrlimittRLIMIT_COREt	setrlimitR�R�RctPopentPIPEtcommunicateRgRsR[tflush(RaR�tSEM_NOGPFAULTERRORBOXR�treport_typetold_modetold_fileR�RctcmdtprocRs((s-/usr/lib64/python2.7/test/support/__init__.pyR��sV				

	cGs�|jdkrdStjjd�r�|jj|j�|jr�ddl}xF|jj	�D]2\}\}}|j
||�|j||�q]Wq�n@ddl}y|j
|j|j�Wnttfk
r�nXdS(sARestore Windows ErrorMode or core file behavior to initial value.NR~i����(R�RYRNR�RRR�R�R�R�R]R�R�R�R�R�R�R�(RaR�R�R�R�R�R�((s-/usr/lib64/python2.7/test/support/__init__.pyR�s	"N(R<R=R>RYR�R�R�R�(((s-/usr/lib64/python2.7/test/support/__init__.pyR;�s
	GcCs*ddl}t��|j�WdQXdS(s�Deliberate crash of Python.

    Python can be killed by a segmentation fault (SIGSEGV), a bus error
    (SIGBUS), or a different error depending on the platform.

    Use SuppressCrashReport() to prevent a crash report from popping up.
    i����N(R�R;t
_read_null(R�((s-/usr/lib64/python2.7/test/support/__init__.pyt
_crash_pythons	
c
Cs�tjjd�rdy!tjd�}t|�dSWqdtk
r`}|jtjkra�qaqdXnd}t	td�r�ytj
d�}Wq�tk
r�q�Xnd
}tjdkr+yd	d
l}|j
Wnttfk
r�q+Xi}x9|j|j|jfD]}|j
|d�||<qWnzyd}xlt|�D]^}ytj|�}Wn+tk
r�}	|	jtjkr��q�qAXtj|�|d7}qAWWd
|d
k	r�x7|j|j|jfD]}|j
|||�q�WnX|S(
s/Count the number of open file descriptors.
    tlinuxtfreebsds
/proc/self/fdiitsysconftSC_OPEN_MAXR;i����Ni(R�R�(RNR�RRRuR�R�R�R�R�R�R�RYtmsvcrtR�RhRFR�R�R�RtduptEBADFR�(
tnamesR�tMAXFDR�R�R�RDtfdtfd2R�((s-/usr/lib64/python2.7/test/support/__init__.pytfd_count#sR

	

	tSaveSignalscBs)eZdZd�Zd�Zd�ZRS(s�
    Save an restore signal handlers.

    This class is only able to save/restore signal handlers registered
    by the Python signal module: see bpo-13285 for "external" signal
    handlers.
    cCs�ddl}||_ttd|j��|_xHdD]@}yt||�}Wntk
rfq7nX|jj|�q7Wi|_dS(Ni����itSIGKILLtSIGSTOP(R�R�(	tsignalRQRtNSIGtsignalsRgRhRwthandlers(RaR�tsignametsignum((s-/usr/lib64/python2.7/test/support/__init__.pyRchs	

cCsIxB|jD]7}|jj|�}|dkr4q
n||j|<q
WdS(N(R�R�t	getsignalRYR�(RaR�thandler((s-/usr/lib64/python2.7/test/support/__init__.pytsaveus
cCs7x0|jj�D]\}}|jj||�qWdS(N(R�R]R�(RaR�R�((s-/usr/lib64/python2.7/test/support/__init__.pytrestore�s(R<R=R>RcR�R�(((s-/usr/lib64/python2.7/test/support/__init__.pyR�_s	
	((ii@i@i@ii(i@ii(((((�R>R<RFt
contextlibR�R/R�R�R�RwRNRuR�R�R@RGREtUserDictRsR�R�RxRjR@RYt__all__t
SHORT_TIMEOUTR�RRRRHRtcontextmanagerRVRDRXRRUR[R6R4RRRR�RRrRR	R
R}RRR�R�R�R�RR�RR
R�RRRRRR�R�RRRR9R
RRt
PIPE_MAX_SIZEt
SOCK_MAX_SIZERRRt	NameErrort
skipUnlesstrequires_unicodeRtFS_NONASCIItunichrt	characterR$R%tdecodetUnicodeErrorRJRRitTESTFN_UNICODEtTESTFN_ENCODINGR�RtTESTFN_UNENCODABLEtevalR&R�R(t
TEST_HTTP_URLR-RR,R0RRyR�tabspatht__file__tTEST_SUPPORT_DIRR6R�RXRRRDRRtobjectR^R�RR R!t	DictMixinR"R�R%R&R#R$R�R�R�R�R�R�R�R�R�R�R'R:R�R�R�t_4GR�R�R(R)RR*R+RRR2RR	R3RR R!R,R#R&R3R,RytHAVE_DOCSTRINGStrequires_docstringsR-tenvironment_alteredR.R/R0RJR7R1RYR[R5tskipIftrequires_type_collectingReR8RqRvR}R;R�R�R�(((s-/usr/lib64/python2.7/test/support/__init__.pyt<module>s�

								
	
	
&					
!										J			<$			
	


												

				
	.			*' /D					

				$	"


		'				
	
					
	(			&
			#	 					
e		<support/script_helper.pyc000064400000013431150327172240011645 0ustar00�
{fc@s.ddlZddlZddlZddlZddlZddlZddlZddlZddlZyddl	Z	Wne
k
r�nXddlmZd�Z
d�Zd�Zd�Zd�Zd�Zd	�Zejd
��Zd�Zd�Zdd
�Zdd�Zded�ZdS(i����N(tstrip_python_stderrc	
Ostjg}|s"|jd�n|j|�tjj�}|j|�tj	|dtj
dtj
dtj
d|�}z|j�\}}Wdtj�|j
j�|jj�X|j}t|�}|r�|s�|r
|r
td||jdd�f��n|||fS(	Ns-Etstdintstdouttstderrtenvs-Process return code is %d, stderr follows:
%stasciitignore(tsyst
executabletappendtextendtostenvirontcopytupdatet
subprocesstPopentPIPEtcommunicatet_cleanupRtcloseRt
returncodeRtAssertionErrortdecode(	texpected_successtargstenv_varstcmd_lineRtptoutterrtrc((s2/usr/lib64/python2.7/test/support/script_helper.pyt_assert_pythons*

	

	cOstt||�S(s�
    Assert that running the interpreter with `args` and optional environment
    variables `env_vars` is ok and return a (return code, stdout, stderr) tuple.
    (R tTrue(RR((s2/usr/lib64/python2.7/test/support/script_helper.pytassert_python_ok2scOstt||�S(s�
    Assert that running the interpreter with `args` and optional environment
    variables `env_vars` fails and return a (return code, stdout, stderr) tuple.
    (R tFalse(RR((s2/usr/lib64/python2.7/test/support/script_helper.pytassert_python_failure9sc
GsWtjdg}|j|�ttjd��#}tj|d|dtj�SWdQXdS(Ns-EtwRR(	RRR
topenRtdevnullRtcalltSTDOUT(RRR'((s2/usr/lib64/python2.7/test/support/script_helper.pytpython_exit_code@s

c	OsGtjdg}|j|�tj|dtjdtjdtj|�S(Ns-ERRR(RRR
RRRR)(RtkwargsR((s2/usr/lib64/python2.7/test/support/script_helper.pytspawn_pythonGs

cCsA|jj�|jj�}|jj�|j�tj�|S(N(RRRtreadtwaitRR(Rtdata((s2/usr/lib64/python2.7/test/support/script_helper.pytkill_pythonNs



cOs+t||�}t|�}|j�|fS(N(R,R0R.(RR+Rtstdout_data((s2/usr/lib64/python2.7/test/support/script_helper.pyt
run_pythonXsccs<tj�}tjj|�}z	|VWdtj|�XdS(N(ttempfiletmkdtempRtpathtrealpathtshutiltrmtree(tdirname((s2/usr/lib64/python2.7/test/support/script_helper.pyttemp_diras
	cCsP|tjd}tjj||�}t|d�}|j|�|j�|S(NtpyR%(RtextsepR5tjoinR&twriteR(t
script_dirtscript_basenametsourcetscript_filenametscript_nametscript_file((s2/usr/lib64/python2.7/test/support/script_helper.pytmake_scriptjs

cCs!tj|dt�|d}|S(Ntdoraisetc(t
py_compiletcompileR!(RCt
compiled_name((s2/usr/lib64/python2.7/test/support/script_helper.pytcompile_scriptrs
cCs�|tjd}tjj||�}tj|d�}|dkrYtjj|�}n|j||�|j	�|tjj||�fS(NtzipR%(
RR<R5R=tzipfiletZipFiletNonetbasenameR>R(tzip_dirtzip_basenameRCtname_in_ziptzip_filenametzip_nametzip_file((s2/usr/lib64/python2.7/test/support/script_helper.pytmake_zip_scriptzs
tcCs!tj|�t|d|�dS(Nt__init__(RtmkdirRE(tpkg_dirtinit_source((s2/usr/lib64/python2.7/test/support/script_helper.pytmake_pkg�s
icCs�g}t|dd�}|j|�tjj|�}	t|||�}
|j|
�|r�t|�}t|
�}
|j||
f�ngtd|d�D]}tjj	|g|�^q�}tjj	|dtjj|
��}
|tj
d}tjj	||�}tj|d�}x3|D]+}tjj	||	�}|j
||�q'W|j
|
|
�|j�x|D]}tj|�qwW|tjj	||
�fS(NRYRXii����RLR%(RER	RR5RPRKR
trangetsepR=R<RMRNR>Rtunlink(RQRRtpkg_nameR@RAtdepthtcompiledR`t	init_namet
init_basenameRCtit	pkg_namestscript_name_in_zipRTRURVtnametinit_name_in_zip((s2/usr/lib64/python2.7/test/support/script_helper.pytmake_zip_pkg�s.

9%


(RRtretos.pathR3RRHt
contextlibR7RMtImportErrorttest.supportRR R"R$R*R,R0R2tcontextmanagerR:RERKRORWR]R#Rk(((s2/usr/lib64/python2.7/test/support/script_helper.pyt<module>s4
						
					support/script_helper.py000064400000013263150327172240011505 0ustar00# Common utility functions used by various script execution tests
#  e.g. test_cmd_line, test_cmd_line_script and test_runpy

import sys
import os
import re
import os.path
import tempfile
import subprocess
import py_compile
import contextlib
import shutil
try:
    import zipfile
except ImportError:
    # If Python is build without Unicode support, importing _io will
    # fail, which, in turn, means that zipfile cannot be imported
    # Most of this module can then still be used.
    pass

from test.support import strip_python_stderr

# Executing the interpreter in a subprocess
def _assert_python(expected_success, *args, **env_vars):
    cmd_line = [sys.executable]
    if not env_vars:
        cmd_line.append('-E')
    cmd_line.extend(args)
    # Need to preserve the original environment, for in-place testing of
    # shared library builds.
    env = os.environ.copy()
    env.update(env_vars)
    p = subprocess.Popen(cmd_line, stdin=subprocess.PIPE,
                         stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                         env=env)
    try:
        out, err = p.communicate()
    finally:
        subprocess._cleanup()
        p.stdout.close()
        p.stderr.close()
    rc = p.returncode
    err =  strip_python_stderr(err)
    if (rc and expected_success) or (not rc and not expected_success):
        raise AssertionError(
            "Process return code is %d, "
            "stderr follows:\n%s" % (rc, err.decode('ascii', 'ignore')))
    return rc, out, err

def assert_python_ok(*args, **env_vars):
    """
    Assert that running the interpreter with `args` and optional environment
    variables `env_vars` is ok and return a (return code, stdout, stderr) tuple.
    """
    return _assert_python(True, *args, **env_vars)

def assert_python_failure(*args, **env_vars):
    """
    Assert that running the interpreter with `args` and optional environment
    variables `env_vars` fails and return a (return code, stdout, stderr) tuple.
    """
    return _assert_python(False, *args, **env_vars)

def python_exit_code(*args):
    cmd_line = [sys.executable, '-E']
    cmd_line.extend(args)
    with open(os.devnull, 'w') as devnull:
        return subprocess.call(cmd_line, stdout=devnull,
                                stderr=subprocess.STDOUT)

def spawn_python(*args, **kwargs):
    cmd_line = [sys.executable, '-E']
    cmd_line.extend(args)
    return subprocess.Popen(cmd_line, stdin=subprocess.PIPE,
                            stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
                            **kwargs)

def kill_python(p):
    p.stdin.close()
    data = p.stdout.read()
    p.stdout.close()
    # try to cleanup the child so we don't appear to leak when running
    # with regrtest -R.
    p.wait()
    subprocess._cleanup()
    return data

def run_python(*args, **kwargs):
    if __debug__:
        p = spawn_python(*args, **kwargs)
    else:
        p = spawn_python('-O', *args, **kwargs)
    stdout_data = kill_python(p)
    return p.wait(), stdout_data

# Script creation utilities
@contextlib.contextmanager
def temp_dir():
    dirname = tempfile.mkdtemp()
    dirname = os.path.realpath(dirname)
    try:
        yield dirname
    finally:
        shutil.rmtree(dirname)

def make_script(script_dir, script_basename, source):
    script_filename = script_basename+os.extsep+'py'
    script_name = os.path.join(script_dir, script_filename)
    script_file = open(script_name, 'w')
    script_file.write(source)
    script_file.close()
    return script_name

def compile_script(script_name):
    py_compile.compile(script_name, doraise=True)
    if __debug__:
        compiled_name = script_name + 'c'
    else:
        compiled_name = script_name + 'o'
    return compiled_name

def make_zip_script(zip_dir, zip_basename, script_name, name_in_zip=None):
    zip_filename = zip_basename+os.extsep+'zip'
    zip_name = os.path.join(zip_dir, zip_filename)
    zip_file = zipfile.ZipFile(zip_name, 'w')
    if name_in_zip is None:
        name_in_zip = os.path.basename(script_name)
    zip_file.write(script_name, name_in_zip)
    zip_file.close()
    #if test.test_support.verbose:
    #    zip_file = zipfile.ZipFile(zip_name, 'r')
    #    print 'Contents of %r:' % zip_name
    #    zip_file.printdir()
    #    zip_file.close()
    return zip_name, os.path.join(zip_name, name_in_zip)

def make_pkg(pkg_dir, init_source=''):
    os.mkdir(pkg_dir)
    make_script(pkg_dir, '__init__', init_source)

def make_zip_pkg(zip_dir, zip_basename, pkg_name, script_basename,
                 source, depth=1, compiled=False):
    unlink = []
    init_name = make_script(zip_dir, '__init__', '')
    unlink.append(init_name)
    init_basename = os.path.basename(init_name)
    script_name = make_script(zip_dir, script_basename, source)
    unlink.append(script_name)
    if compiled:
        init_name = compile_script(init_name)
        script_name = compile_script(script_name)
        unlink.extend((init_name, script_name))
    pkg_names = [os.sep.join([pkg_name]*i) for i in range(1, depth+1)]
    script_name_in_zip = os.path.join(pkg_names[-1], os.path.basename(script_name))
    zip_filename = zip_basename+os.extsep+'zip'
    zip_name = os.path.join(zip_dir, zip_filename)
    zip_file = zipfile.ZipFile(zip_name, 'w')
    for name in pkg_names:
        init_name_in_zip = os.path.join(name, init_basename)
        zip_file.write(init_name, init_name_in_zip)
    zip_file.write(script_name, script_name_in_zip)
    zip_file.close()
    for name in unlink:
        os.unlink(name)
    #if test.test_support.verbose:
    #    zip_file = zipfile.ZipFile(zip_name, 'r')
    #    print 'Contents of %r:' % zip_name
    #    zip_file.printdir()
    #    zip_file.close()
    return zip_name, os.path.join(zip_name, script_name_in_zip)
support/__init__.pyc000064400000211622150327172240010543 0ustar00�
{fc=@s�
dZedkr!ed��nddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZyddlZWnek
r:dZnXddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d4d<d=d>d?d@g=ZdAZdefdB��YZdefdC��YZdefdD��YZdejfdE��YZ ej!e"dF��Z#e$dG�Z%dH�Z&dI�Z'd�d�e$dJ�Z(dK�Z)dLZ*dZ+dMa,dMa-e$Z.da/dN�Z0dO�Z1dP�Z2dQ�Z3e
jj4dR�r+e$dS�Z5dT�Z6dU�Z7dV�Z8nej9Z6ej:Z7dW�Z8dX�Z9dY�Z:dZ�Z;d[�Z<d\�Z=d]�Z>dd^�Z?d_�Z@d`ZAdaZBejCejDdb�ZEeAdc�ZFdd�ZGeG�ZHde�ZIdfZJdg�ZKd�ZLd�ZMe
jj4dk�ZNyeOe"ZPWneQk
r-e$ZPnXejRePdl�ZSdm�ZTdZUePrx�eVdn�eVdo�eVdp�eVdq�eVdr�eVds�eVdt�eVdu�eVdv�eVdw�eVdx�fD]XZWy7eWjXe
jY��jZe
jY��eWkr�e[�nWne[k
rq�XeWZUPq�Wnej\dkkr6dyZ]n�ej\dzkrNd{Z]n�d|Z]ePr�e^d}eO�rrd~Z_neOd~d�Z_e
jY�Z`eae
d��s�e
jb�d�d�kr�dZcq�edd��ZcyecjXd��Wneek
r�q�Xd�ecGHnd�jfe]ejg��Z]d�Zheji�Zjej!de$d���Zkej!e$d���Zlej!d�e$d���Zmejnjoejnjpeq��Zrejnjoer�Zsejnjtesd��Zudd��Zvd��Zwd��Zxd}ddd��Zydd��Zzd�e{fd���YZ|e$d��Z}ej!d���Z~ej!d���Zd&e{fd���YZ�d'ej�fd���YZ�d�e{fd���YZ�d*e{fd���YZ�ej!dAd�d���Z�ej!d���Z�d��Z�d��Z�d��Z�d��Z�d�Z�eae
d��r�d�e�Z�ne�d�Z�d��Z�d��Z�d�Z�d�Z�d��Z�d��Z�d��Z�d�Z�die�Z�d�e�Z�dhe�Z�e
j�Z�d��Z�d�e�d��Z�d�e�e"d��Z�d��Z�d0d�d���YZ�d��Z�d��Z�d��Z�dd��Z�d��Z�d��Z�d��Z�d��Z�da�da�d��Z�d��Z�d��Z�d��Z�e�d�e$�pW	e
jd�kpW	ej�d��Z�ejRe�d��Z�dd��Z�e$Z�d��Z�d��Z�d��Z�ej!d�d���Z�d��Z�ej!dd���Z�ej!d���Z�ej!d���Z�d��Z�ej�eae
d��d��Z�d��Z�d��Z�d�d��Z�ej!d���Z�d��Z�d@d�d���YZ�d��Z�d��Z�d�d�d���YZ�dS(�s7Supporting definitions for the Python regression tests.stest.supports3test.support must be imported from the test packagei����NtErrort
TestFailedt
TestDidNotRuntResourceDeniedt
import_moduletverboset
use_resourcest
max_memusetrecord_original_stdouttget_original_stdouttunloadtunlinktrmtreetforgettis_resource_enabledtrequirestrequires_mac_vertfind_unused_portt	bind_porttfcmpthave_unicodet	is_jythontTESTFNtHOSTtFUZZtSAVEDCWDttemp_cwdtfindfiletsortdicttcheck_syntax_errortopen_urlresourcetcheck_warningstcheck_py3k_warningstCleanImporttEnvironmentVarGuardtcaptured_outputtcaptured_stdouttTransientResourcettransient_internettrun_with_localetset_memlimitt
bigmemtesttbigaddrspacetesttBasicTestRunnertrun_unittesttrun_doctesttthreading_setuptthreading_cleanuptreap_threadst
start_threadstcpython_onlytcheck_impl_detailt
get_attributet
py3k_bytestimport_fresh_modulet
reap_childrentstrip_python_stderrtIPV6_ENABLEDtrun_with_tztSuppressCrashReportg>@cBseZdZRS(s*Base class for regression test exceptions.(t__name__t
__module__t__doc__(((s-/usr/lib64/python2.7/test/support/__init__.pyR4scBseZdZRS(sTest failed.(R<R=R>(((s-/usr/lib64/python2.7/test/support/__init__.pyR7scBseZdZRS(sTest did not run any subtests.(R<R=R>(((s-/usr/lib64/python2.7/test/support/__init__.pyR:scBseZdZRS(s�Test skipped because it requested a disallowed resource.

    This is raised when a test calls requires() for a resource that
    has not been enabled.  It is used to distinguish between expected
    and unexpected skips.
    (R<R=R>(((s-/usr/lib64/python2.7/test/support/__init__.pyR=sccs=|r4tj��tjddt�dVWdQXndVdS(s�Context manager to suppress package and module deprecation
    warnings when importing them.

    If ignore is False, this context manager has no effect.tignores.+ (module|package)N(twarningstcatch_warningstfilterwarningstDeprecationWarning(R?((s-/usr/lib64/python2.7/test/support/__init__.pyt_ignore_deprecated_importsEs
c	CsSt|��Aytj|�SWn(tk
rH}tjt|���nXWdQXdS(s�Import and return the module to be tested, raising SkipTest if
    it is not available.

    If deprecated is True, any module or package deprecation messages
    will be suppressed.N(RDt	importlibRtImportErrortunittesttSkipTesttstr(tnamet
deprecatedtmsg((s-/usr/lib64/python2.7/test/support/__init__.pyRTs

cCs�|tjkr&t|�tj|=nxTttj�D]C}||ks[|j|d�r6tj|||<tj|=q6q6WdS(swHelper function to save and remove a module from sys.modules

       Raise ImportError if the module can't be imported.t.N(tsystmodulest
__import__tlistt
startswith(RJtorig_modulestmodname((s-/usr/lib64/python2.7/test/support/__init__.pyt_save_and_remove_moduleas

cCsFt}ytj|||<Wntk
r4t}nXdtj|<|S(s�Helper function to save and block a module in sys.modules

       Return True if the module was in sys.modules, False otherwise.N(tTrueRNROtKeyErrortFalsetNone(RJRStsaved((s-/usr/lib64/python2.7/test/support/__init__.pyt_save_and_block_modulens


cCs�t|���i}g}t||�zyax|D]}t||�q3Wx-|D]%}t||�sQ|j|�qQqQWtj|�}Wntk
r�d}nXWdx'|j�D]\}	}
|
t	j
|	<q�Wx|D]}t	j
|=q�WX|SWdQXdS(sImports and returns a module, deliberately bypassing the sys.modules cache
    and importing a fresh copy of the module. Once the import is complete,
    the sys.modules cache is restored to its original state.

    Modules named in fresh are also imported anew if needed by the import.
    If one of these modules can't be imported, None is returned.

    Importing of modules named in blocked is prevented while the fresh import
    takes place.

    If deprecated is True, any module or package deprecation messages
    will be suppressed.N(RDRUR[tappendRERRFRYtitemsRNRO(RJtfreshtblockedRKRStnames_to_removet
fresh_nametblocked_nametfresh_modulet	orig_nametmoduletname_to_remove((s-/usr/lib64/python2.7/test/support/__init__.pyR6{s&





cCs�yt||�}Wn�tk
r�t|tj�rKd|j|f}n�t|tj�rsd|j|f}nit|tj�r�d|jj|f}n>t|t	�r�d|j|f}ndt	|�j|f}t
j|��nX|SdS(s?Get an attribute, raising SkipTest if AttributeError is raised.smodule %r has no attribute %rsclass %s has no attribute %rs%s instance has no attribute %rs"type object %r has no attribute %rs%r object has no attribute %rN(tgetattrtAttributeErrort
isinstancettypest
ModuleTypeR<t	ClassTypetInstanceTypet	__class__ttypeRGRH(tobjRJt	attributeRL((s-/usr/lib64/python2.7/test/support/__init__.pyR4�s
iicCs
|adS(N(t_original_stdout(tstdout((s-/usr/lib64/python2.7/test/support/__init__.pyR�scCs
tptjS(N(RrRNRs(((s-/usr/lib64/python2.7/test/support/__init__.pyR	�scCs&ytj|=Wntk
r!nXdS(N(RNRORW(RJ((s-/usr/lib64/python2.7/test/support/__init__.pyR
�s
cGsxy||�SWnctk
rs}tdkrVd|jj|fGHd|j|fGHntj|tj�||�SXdS(Nis%s: %ssre-run %s%r(tEnvironmentErrorRRnR<tostchmodtstattS_IRWXU(tpathtfunctargsterr((s-/usr/lib64/python2.7/test/support/__init__.pyt
_force_run�stwincCs�||�|r|}n$tjj|�\}}|p:d}d}xR|dkr�tj|�}|rm|n	||ks}dStj|�|d9}qFWtjd|tdd�dS(NRMg����MbP?g�?is)tests may fail, delete still pending for t
stackleveli(	RuRytsplittlistdirttimetsleepR@twarntRuntimeWarning(RztpathnametwaitalltdirnameRJttimeouttL((s-/usr/lib64/python2.7/test/support/__init__.pyt_waitfor�s
	

cCsttj|�dS(N(R�RuR(tfilename((s-/usr/lib64/python2.7/test/support/__init__.pyt_unlink�scCsttj|�dS(N(R�Rutrmdir(R�((s-/usr/lib64/python2.7/test/support/__init__.pyt_rmdir�scs6�fd��t�|dt�td�|�dS(Ncs�x�t|tj|�D]i}tjj||�}tjj|�rlt�|dt�t|tj|�qt|tj	|�qWdS(NR�(
R}RuR�RytjointisdirR�RVR�R(RyRJtfullname(t
_rmtree_inner(s-/usr/lib64/python2.7/test/support/__init__.pyR�sR�cSst|tj|�S(N(R}RuR�(tp((s-/usr/lib64/python2.7/test/support/__init__.pyt<lambda>	t(R�RV(Ry((R�s-/usr/lib64/python2.7/test/support/__init__.pyt_rmtree�scsSytj|�dSWntk
r(nX�fd���|�tj|�dS(Ncs�x�t|tj|�D]�}tjj||�}ytj|�j}Wntk
r`d}nXtj	|�r��|�t|tj
|�qt|tj|�qWdS(Ni(R}RuR�RyR�tlstattst_modeRtRwtS_ISDIRR�R(RyRJR�tmode(R�(s-/usr/lib64/python2.7/test/support/__init__.pyR�s


(tshutilRRtRuR�(Ry((R�s-/usr/lib64/python2.7/test/support/__init__.pyR�s


cCsIyt|�Wn4tk
rD}|jtjtjfkrE�qEnXdS(N(R�tOSErrorterrnotENOENTtENOTDIR(R�texc((s-/usr/lib64/python2.7/test/support/__init__.pyR$s
cCs@yt|�Wn+tk
r;}|jtjkr<�q<nXdS(N(R�R�R�R�(R�terror((s-/usr/lib64/python2.7/test/support/__init__.pyR�+s
cCsIyt|�Wn4tk
rD}|jtjtjfkrE�qEnXdS(N(R�R�R�R�tESRCH(Ryte((s-/usr/lib64/python2.7/test/support/__init__.pyR3s
cCsjt|�xYtjD]N}ttjj||tjd��ttjj||tjd��qWdS(sm"Forget" a module was ever imported by removing it from sys.modules and
    deleting any .pyc and .pyo files.tpyctpyoN(R
RNRyRRuR�textsep(RTR�((s-/usr/lib64/python2.7/test/support/__init__.pyR
;s
$cs�ttd�rtjSd}tjjd�r ddl�ddl�d}d}d�j	f�fd��Y}�j
j}|j�}|s��j
��n|�}�jj�}|j||�j|��j|��j|��}|s�j
��nt|j|@�s�d}q�n�tjdkr�dd	lm}	m�m}
m	}dd
lm}|	j|d��}
|
j�dkr�d
}q�d|f�fd��Y}|�}|
|�}|
j|�dks�|
j|�dkr�d}q�n|s�y;ddlm}|�}|j �|j!�|j"�Wq�t#k
r�}t$|�}t%|�dkrz|d d}ndj&t'|�j(|�}q�Xn|t_)|t_tjS(NtresultR~i����itUSEROBJECTFLAGScs;eZd�jjfd�jjfd�jjfgZRS(tfInheritt	fReservedtdwFlags(R<R=twintypestBOOLtDWORDt_fields_((tctypes(s-/usr/lib64/python2.7/test/support/__init__.pyR�Rss,gui not available (WSF_VISIBLE flag not set)tdarwin(tcdlltc_inttpointert	Structure(tfind_librarytApplicationServicesis0gui tests cannot run without OS X window managertProcessSerialNumbercs eZd�fd�fgZRS(t
highLongOfPSNtlowLongOfPSN(R<R=R�((R�(s-/usr/lib64/python2.7/test/support/__init__.pyR�ts	s#cannot run without OS X gui process(tTki2s [...]sTk unavailable due to {}: {}(*thasattrt_is_gui_availableR�RYRNtplatformRRR�tctypes.wintypesR�twindlltuser32tGetProcessWindowStationtWinErrorR�R�tGetUserObjectInformationWtbyreftsizeoftboolR�R�R�R�tctypes.utilR�tLoadLibrarytCGMainDisplayIDtGetCurrentProcesstSetFrontProcesstTkinterR�twithdrawtupdatetdestroyt	ExceptionRItlentformatRoR<treason(R�t	UOI_FLAGStWSF_VISIBLER�tdllthtuoftneededtresR�R�R�R�tapp_servicesR�tpsntpsn_pR�trootR�t
err_string((R�R�s-/usr/lib64/python2.7/test/support/__init__.pyR�Gsh		"			

	
cCstdkp|tkS(s�Test whether a resource is enabled.

    Known resources are set by regrtest.py.  If not running under regrtest.py,
    all resources are assumed enabled unless use_resources has been set.
    N(RRY(tresource((s-/usr/lib64/python2.7/test/support/__init__.pyR�scCs`t|�s4|dkr%d|}nt|��n|dkr\t�r\ttj��ndS(s@Raise ResourceDenied if the specified resource is not available.s$Use of the `%s' resource not enabledtguiN(RRYRR�R�(R�RL((s-/usr/lib64/python2.7/test/support/__init__.pyR�s
cs�fd�}|S(s�Decorator raising SkipTest if the OS is Mac OS X and the OS X
    version if less than min_version.

    For example, @requires_mac_ver(10, 5) raises SkipTest if the OS X version
    is lesser than 10.5.
    cs.tj����fd��}�|_|S(Ncs�tjdkr�tj�d}y"ttt|jd���}Wntk
rTq�X|�kr�djtt	���}t
jd||f��q�n�||�S(NR�iRMs&Mac OS X %s or higher required, not %s(RNR�tmac_verttupletmaptintR�t
ValueErrorR�RIRGRH(R{tkwtversion_txttversiontmin_version_txt(Rztmin_version(s-/usr/lib64/python2.7/test/support/__init__.pytwrapper�s"
(t	functoolstwrapsR�(RzR�(R�(Rzs-/usr/lib64/python2.7/test/support/__init__.pyt	decorator�s!	((R�R�((R�s-/usr/lib64/python2.7/test/support/__init__.pyR�ss	127.0.0.1s::1cCs/tj||�}t|�}|j�~|S(s�
Returns an unused port that should be suitable for binding.  This is
    achieved by creating a temporary socket with the same family and type as
    the 'sock' parameter (default is AF_INET, SOCK_STREAM), and binding it to
    the specified host address (defaults to 0.0.0.0) with the port set to 0,
    eliciting an unused ephemeral port from the OS.  The temporary socket is
    then closed and deleted, and the ephemeral port is returned.

    Either this method or bind_port() should be used for any tests where a
    server socket needs to be bound to a particular port for the duration of
    the test.  Which one to use depends on whether the calling code is creating
    a python socket, or if an unused port needs to be provided in a constructor
    or passed to an external program (i.e. the -accept argument to openssl's
    s_server mode).  Always prefer bind_port() over find_unused_port() where
    possible.  Hard coded ports should *NEVER* be used.  As soon as a server
    socket is bound to a hard coded port, the ability to run multiple instances
    of the test simultaneously on the same host is compromised, which makes the
    test a ticking time bomb in a buildbot environment. On Unix buildbots, this
    may simply manifest as a failed test, which can be recovered from without
    intervention in most cases, but on Windows, the entire python process can
    completely and utterly wedge, requiring someone to log in to the buildbot
    and manually kill the affected process.

    (This is easy to reproduce on Windows, unfortunately, and can be traced to
    the SO_REUSEADDR socket option having different semantics on Windows versus
    Unix/Linux.  On Unix, you can't have two AF_INET SOCK_STREAM sockets bind,
    listen and then accept connections on identical host/ports.  An EADDRINUSE
    socket.error will be raised at some point (depending on the platform and
    the order bind and listen were called on each socket).

    However, on Windows, if SO_REUSEADDR is set on the sockets, no EADDRINUSE
    will ever be raised when attempting to bind two identical host/ports. When
    accept() is called on each socket, the second caller's process will steal
    the port from the first caller, leaving them both in an awkwardly wedged
    state where they'll no longer respond to any signals or graceful kills, and
    must be forcibly killed via OpenProcess()/TerminateProcess().

    The solution on Windows is to use the SO_EXCLUSIVEADDRUSE socket option
    instead of SO_REUSEADDR, which effectively affords the same semantics as
    SO_REUSEADDR on Unix.  Given the propensity of Unix developers in the Open
    Source world compared to Windows ones, this is a common mistake.  A quick
    look over OpenSSL's 0.9.8g source shows that they use SO_REUSEADDR when
    openssl.exe is called with the 's_server' option, for example. See
    http://bugs.python.org/issue2550 for more info.  The following site also
    has a very thorough description about the implications of both REUSEADDR
    and EXCLUSIVEADDRUSE on Windows:
    http://msdn2.microsoft.com/en-us/library/ms740621(VS.85).aspx)

    XXX: although this approach is a vast improvement on previous attempts to
    elicit unused ports, it rests heavily on the assumption that the ephemeral
    port returned to us by the OS won't immediately be dished back out to some
    other process when we close and delete our temporary socket but before our
    calling code has a chance to bind the returned port.  We can deal with this
    issue if/when we come across it.(tsocketRtclose(tfamilytsocktypettempsocktport((s-/usr/lib64/python2.7/test/support/__init__.pyR�s
6
cCs|jtjkr�|jtjkr�ttd�rc|jtjtj�dkrct	d��qcnttd�r�y1|jtjtj
�dkr�t	d��nWq�tk
r�q�Xnttd�r�|jtjtj
d�q�n|j|df�|j�d}|S(s%Bind the socket to a free port and return the port number.  Relies on
    ephemeral ports in order to ensure we are using an unbound port.  This is
    important as many tests may be running simultaneously, especially in a
    buildbot environment.  This method raises an exception if the sock.family
    is AF_INET and sock.type is SOCK_STREAM, *and* the socket has SO_REUSEADDR
    or SO_REUSEPORT set on it.  Tests should *never* set these socket options
    for TCP/IP sockets.  The only case for setting these options is testing
    multicasting via multiple UDP sockets.

    Additionally, if the SO_EXCLUSIVEADDRUSE socket option is available (i.e.
    on Windows), it will be set on the socket.  This will prevent anyone else
    from bind()'ing to our host/port for the duration of the test.
    tSO_REUSEADDRisHtests should never set the SO_REUSEADDR socket option on TCP/IP sockets!tSO_REUSEPORTsHtests should never set the SO_REUSEPORT socket option on TCP/IP sockets!tSO_EXCLUSIVEADDRUSEi(R�R�tAF_INETRotSOCK_STREAMR�t
getsockoptt
SOL_SOCKETR�RR�Rtt
setsockoptR�tbindtgetsockname(tsockthostR�((s-/usr/lib64/python2.7/test/support/__init__.pyRs$
cCs{tjrwd}zNy3tjtjtj�}|jtdf�tSWntjk
r[nXWd|rs|j	�nXnt
S(s+Check whether IPv6 is enabled on this host.iN(R�thas_ipv6RYtAF_INET6R�RtHOSTv6RVR�R�RX(R((s-/usr/lib64/python2.7/test/support/__init__.pyt_is_ipv6_enabled$s	cs"tj���fd��}|S(s5Skip the test on TLS certificate validation failures.csRy�||�Wn:tk
rM}dt|�krGtjd��n�nXdS(NtCERTIFICATE_VERIFY_FAILEDs.system does not contain necessary certificates(tIOErrorRIRGRH(R{tkwargsR�(tf(s-/usr/lib64/python2.7/test/support/__init__.pytdec7s(R�R�(RR((Rs-/usr/lib64/python2.7/test/support/__init__.pytsystem_must_validate_cert5s	g���ư>cCs#t|t�st|t�rcy8t|�t|�t}t||�|krUdSWqqXn�t|�t|�krt|ttf�rxPttt	|�t	|���D]-}t
||||�}|dkr�|Sq�Wt	|�t	|�kt	|�t	|�kS||k||kS(Ni(RitfloattabsRRoR�RQtrangetminR�R(txtytfuzztitoutcome((s-/usr/lib64/python2.7/test/support/__init__.pyRDs-(,iiitjavasno unicode supportcCs
t|d�S(Nsunicode-escape(tunicode(ts((s-/usr/lib64/python2.7/test/support/__init__.pytumsi�i0iAi�ii�ii*ii�i� s$testtriscosttestfiles@testR�s@test-��slatin-1tgetwindowsversioniis'u"@test-\u5171\u6709\u3055\u308c\u308b"tLatin1sgWARNING: The filename %r CAN be encoded by the filesystem.  Unicode filename tests may not be effectives	{}_{}_tmpshttp://www.pythontest.netccsQt}|dkrEddl}|j�}t}tjj|�}n�tr�t	|t
�r�tjjr�y|jt
j�pd�}Wq�tk
r�|s�tjd��q�q�Xnytj|�t}Wn7tk
r|s��ntjd|tdd�nX|rtj�}nz	|VWd|rL|tj�krLt|�nXdS(s�Return a context manager that creates a temporary directory.

    Arguments:

      path: the directory to create temporarily.  If omitted or None,
        defaults to creating a temporary directory using tempfile.mkdtemp.

      quiet: if False (the default), the context manager raises an exception
        on error.  Otherwise, if the path is specified and cannot be
        created, only a warning is issued.

    i����Ntasciis;unable to encode the cwd name with the filesystem encoding.s+tests may fail, unable to create temp dir: Ri(RXRYttempfiletmkdtempRVRuRytrealpathRRiRtsupports_unicode_filenamestencodeRNtgetfilesystemencodingtUnicodeEncodeErrorRGRHtmkdirR�R@R�R�tgetpidR(Rytquiettdir_createdR tpid((s-/usr/lib64/python2.7/test/support/__init__.pyttemp_dir�s6





	ccs{tj�}ytj|�Wn7tk
rV|s9�ntjd|tdd�nXztj�VWdtj|�XdS(sgReturn a context manager that changes the current working directory.

    Arguments:

      path: the directory to use as the temporary current working directory.

      quiet: if False (the default), the context manager raises an exception
        on error.  Otherwise, it issues only a warning and keeps the current
        working directory the same.

    s)tests may fail, unable to change CWD to: RiN(RutgetcwdtchdirR�R@R�R�(RyR)t	saved_dir((s-/usr/lib64/python2.7/test/support/__init__.pyt
change_cwds


ttempcwdc	csBtd|d|��'}t|d|��}|VWdQXWdQXdS(s�
    Context manager that temporarily creates and changes the CWD.

    The function temporarily changes the current working directory
    after creating a temporary directory in the current directory with
    name *name*.  If *name* is None, the temporary directory is
    created using tempfile.mkdtemp.

    If *quiet* is False (default) and it is not possible to
    create or change the CWD, an error is raised.  If *quiet* is True,
    only a warning is raised and the original CWD is used.

    RyR)N(R,R0(RJR)t	temp_pathtcwd_dir((s-/usr/lib64/python2.7/test/support/__init__.pyR&stdatacCs�tjj|�r|S|dk	r:tjj||�}ntgtj}x9|D]1}tjj||�}tjj|�rQ|SqQW|S(s�Try to find a file on sys.path and the working directory.  If it is not
    found the argument passed to the function is returned (this does not
    necessarily signal failure; could still be the legitimate path).N(RuRytisabsRYR�t
TEST_HOME_DIRRNtexists(tfiletsubdirRytdntfn((s-/usr/lib64/python2.7/test/support/__init__.pyRAs
cCsJ|j�}|j�g|D]}d|^q}dj|�}d|S(s%Like repr(dict), but in sorted order.s%r: %rs, s{%s}(R]tsortR�(tdictR]tpairt	reprpairst
withcommas((s-/usr/lib64/python2.7/test/support/__init__.pyROs

cCs9ttd�}z|j�SWd|j�tt�XdS(s`
    Create an invalid file descriptor by opening and closing a file and return
    its fd.
    twbN(topenRtfilenoR�R(R8((s-/usr/lib64/python2.7/test/support/__init__.pytmake_bad_fdWs

cCs||jt|��}t|dd�WdQX|j}|dk	rV|j|j|�n|dk	rx|j|j|�ndS(Ns
<test string>texec(tassertRaisesRegexptSyntaxErrortcompilet	exceptionRYtassertEqualtlinenotoffset(ttestcaset	statementterrtextRKRLtcmR|((s-/usr/lib64/python2.7/test/support/__init__.pyRcs	c
sSddl}ddl}|j|�djd�d}tjjt|�}�fd�}tjj|�r�||�}|dk	r�|St	|�nt
d�t�d|IJ|j|dd�}zNt
|d	��9}|j�}	x#|	r
|j|	�|j�}	q�WWdQXWd|j�X||�}|dk	r?|Std
|��dS(Ni����it/csGt|�}�dkr|S�|�r9|jd�|S|j�dS(Ni(RBRYtseekR�(R;R(tcheck(s-/usr/lib64/python2.7/test/support/__init__.pytcheck_valid_filess
turlfetchs	fetching %s ...R�iRAsinvalid resource "%s"(turlparseturllib2R�RuRyR�t
TEST_DATA_DIRR7RYRRR	turlopenRBtreadtwriteR�R(
turlRSRVRWR�R;RTRtoutR((RSs-/usr/lib64/python2.7/test/support/__init__.pyRls. 	

	
tWarningsRecordercBs8eZdZd�Zd�Zed��Zd�ZRS(syConvenience wrapper for the warnings list returned on
       entry to the warnings.catch_warnings() context manager.
    cCs||_d|_dS(Ni(t	_warningst_last(tselft
warnings_list((s-/usr/lib64/python2.7/test/support/__init__.pyt__init__�s	cCs\t|j�|jkr,t|jd|�S|tjjkrBdStd||f��dS(Ni����s%r has no attribute %r(	R�R_R`RgR@tWarningMessaget_WARNING_DETAILSRYRh(Ratattr((s-/usr/lib64/python2.7/test/support/__init__.pyt__getattr__�s
cCs|j|jS(N(R_R`(Ra((s-/usr/lib64/python2.7/test/support/__init__.pyR@�scCst|j�|_dS(N(R�R_R`(Ra((s-/usr/lib64/python2.7/test/support/__init__.pytreset�s(R<R=R>RcRgtpropertyR@Rh(((s-/usr/lib64/python2.7/test/support/__init__.pyR^�s
		c
csptjd�}|jjd�}|r4|j�ntjdt��&}tjdj	d�t
|�VWdQXg|D]}|j^qu}g}x�|D]�\}}	t}
x[|D]R}t
|�}tj||tj�r�t|j|	�r�t}
|j|�q�q�W|
r�|r�|j||	jf�q�q�W|rOtd|d��n|rltd	|d��ndS(
s�Catch the warnings, then check if all the expected
    warnings have been raised and re-raise unexpected warnings.
    If 'quiet' is True, only re-raise the unexpected warnings.
    it__warningregistry__trecordR@talwaysNsunhandled warning %ris)filter (%r, %s) did not catch any warning(RNt	_getframet	f_globalstgettclearR@RARVROtsimplefilterR^tmessageRXRItretmatchtIt
issubclassRntremoveR\R<tAssertionError(
tfiltersR)tframetregistrytwtwarningtreraisetmissingRLtcattseenR�Rr((s-/usr/lib64/python2.7/test/support/__init__.pyt_filterwarnings�s0
cOsI|jd�}|s<dtff}|dkr<t}q<nt||�S(s�Context manager to silence warnings.

    Accept 2-tuples as positional arguments:
        ("message regexp", WarningCategory)

    Optional argument:
     - if 'quiet' is True, it does not fail if a filter catches nothing
        (default True without argument,
         default False if some filters are defined)

    Without argument, it defaults to:
        check_warnings(("", Warning), quiet=True)
    R)R�N(RotWarningRYRVR�(RyR
R)((s-/usr/lib64/python2.7/test/support/__init__.pyR�scOs@tjr$|s*dtff}q*nd}t||jd��S(sjContext manager to silence py3k warnings.

    Accept 2-tuples as positional arguments:
        ("message regexp", WarningCategory)

    Optional argument:
     - if 'quiet' is True, it does not fail if a filter catches nothing
        (default False)

    Without argument, it defaults to:
        check_py3k_warnings(("", DeprecationWarning), quiet=False)
    R�R)((RNtpy3kwarningRCR�Ro(RyR
((s-/usr/lib64/python2.7/test/support/__init__.pyR �s
	cBs)eZdZd�Zd�Zd�ZRS(s,Context manager to force import to return a new module reference.

    This is useful for testing module-level behaviours, such as
    the emission of a DeprecationWarning on import.

    Use like this:

        with CleanImport("foo"):
            importlib.import_module("foo") # new reference
    cGsotjj�|_xV|D]N}|tjkrtj|}|j|krZtj|j=ntj|=qqWdS(N(RNROtcopytoriginal_modulesR<(Ratmodule_namestmodule_nameRe((s-/usr/lib64/python2.7/test/support/__init__.pyRcs

cCs|S(N((Ra((s-/usr/lib64/python2.7/test/support/__init__.pyt	__enter__scGstjj|j�dS(N(RNROR�R�(Rat
ignore_exc((s-/usr/lib64/python2.7/test/support/__init__.pyt__exit__s(R<R=R>RcR�R�(((s-/usr/lib64/python2.7/test/support/__init__.pyR!s
	
	cBs_eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
s_Class to help protect the environment variable properly.  Can be used as
    a context manager.cCstj|_i|_dS(N(Rutenviront_environt_changed(Ra((s-/usr/lib64/python2.7/test/support/__init__.pyRc(scCs|j|S(N(R�(Ratenvvar((s-/usr/lib64/python2.7/test/support/__init__.pyt__getitem__,scCs<||jkr+|jj|�|j|<n||j|<dS(N(R�R�Ro(RaR�tvalue((s-/usr/lib64/python2.7/test/support/__init__.pyt__setitem__/scCsK||jkr+|jj|�|j|<n||jkrG|j|=ndS(N(R�R�Ro(RaR�((s-/usr/lib64/python2.7/test/support/__init__.pyt__delitem__5scCs
|jj�S(N(R�tkeys(Ra((s-/usr/lib64/python2.7/test/support/__init__.pyR�<scCs|||<dS(N((RaR�R�((s-/usr/lib64/python2.7/test/support/__init__.pytset?scCs||=dS(N((RaR�((s-/usr/lib64/python2.7/test/support/__init__.pytunsetBscCs|S(N((Ra((s-/usr/lib64/python2.7/test/support/__init__.pyR�EscGshxU|jj�D]D\}}|dkrG||jkrT|j|=qTq||j|<qW|jt_dS(N(R�R]RYR�RuR�(RaR�tktv((s-/usr/lib64/python2.7/test/support/__init__.pyR�Hs(R<R=R>RcR�R�R�R�R�R�R�R�(((s-/usr/lib64/python2.7/test/support/__init__.pyR"#s								t
DirsOnSysPathcBs)eZdZd�Zd�Zd�ZRS(s�Context manager to temporarily add directories to sys.path.

    This makes a copy of sys.path, appends any directories given
    as positional arguments, then reverts sys.path to the copied
    settings when the context ends.

    Note that *all* sys.path modifications in the body of the
    context manager, including replacement of the object,
    will be reverted at the end of the block.
    cGs-tj|_tj|_tjj|�dS(N(RNRytoriginal_valuetoriginal_objecttextend(Ratpaths((s-/usr/lib64/python2.7/test/support/__init__.pyRc^s
cCs|S(N((Ra((s-/usr/lib64/python2.7/test/support/__init__.pyR�cscGs|jt_|jtj(dS(N(R�RNRyR�(RaR�((s-/usr/lib64/python2.7/test/support/__init__.pyR�fs(R<R=R>RcR�R�(((s-/usr/lib64/python2.7/test/support/__init__.pyR�Rs
		cBs2eZdZd�Zd�Zdddd�ZRS(s�Raise ResourceDenied if an exception is raised while the context manager
    is in effect that matches the specified exception and attributes.cKs||_||_dS(N(R�tattrs(RaR�R
((s-/usr/lib64/python2.7/test/support/__init__.pyRcps	cCs|S(N((Ra((s-/usr/lib64/python2.7/test/support/__init__.pyR�tscCs}|dk	ryt|j|�ryxX|jj�D]8\}}t||�sMPnt||�|kr.Pq.q.Wtd��ndS(s�If type_ is a subclass of self.exc and value has attributes matching
        self.attrs, raise ResourceDenied.  Otherwise let the exception
        propagate (if any).s%an optional resource is not availableN(RYRvR�R�t	iteritemsR�RgR(Rattype_R�t	tracebackRft
attr_value((s-/usr/lib64/python2.7/test/support/__init__.pyR�wsN(R<R=R>RcR�RYR�(((s-/usr/lib64/python2.7/test/support/__init__.pyR%ks		c#s�dddd d!d"g}d#d$d%d&d'g}td|��|�g��s�g|D]\}}tt||�^qV�g|D]\}}tt||�^q��n���fd�}tj�}z�y%|dk	r�tj|�ndVWn�tk
r�}	xxtr}|	j	}
t
|
�dkrGt|
dt�rG|
d}	qt
|
�dkryt|
dt�ry|
d}	qPqW||	��nXWdtj|�XdS((s�Return a context manager that raises ResourceDenied when various issues
    with the Internet connection manifest themselves as exceptions.tECONNREFUSEDiot
ECONNRESETihtEHOSTUNREACHiqtENETUNREACHiet	ETIMEDOUTint
EADDRNOTAVAILict	EAI_AGAINi����tEAI_FAILi����t
EAI_NONAMEi����t
EAI_NODATAi����t
WSANO_DATAi�*sResource '%s' is not availablecst|dd�}t|tj�sNt|tj�rB|�ksN|�kr{tsrtjj	�j
dd�n��ndS(NR�is
(RgRYRiR�R�tgaierrorRRNtstderrR[R{(R|tn(tcaptured_errnostdeniedt
gai_errnos(s-/usr/lib64/python2.7/test/support/__init__.pytfilter_error�sNiii(R�io(R�ih(R�iq(R�ie(R�in(R�ic(R�i����(R�i����(R�i����(R�i����(R�i�*(RRgR�R�tgetdefaulttimeoutRYtsetdefaulttimeoutR	RVR{R�Ri(t
resource_nameR�terrnostdefault_errnostdefault_gai_errnosRJtnumR�told_timeoutR|ta((R�R�R�s-/usr/lib64/python2.7/test/support/__init__.pyR&�sJ		(+				%
%

ccs[ddl}tt|�}tt||j��ztt|�VWdtt||�XdS(s�Return a context manager used by captured_stdout and captured_stdin
    that temporarily replaces the sys stream *stream_name* with a StringIO.i����N(tStringIORgRNtsetattr(tstream_nameR�torig_stdout((s-/usr/lib64/python2.7/test/support/__init__.pyR#�scCs
td�S(s�Capture the output of sys.stdout:

       with captured_stdout() as s:
           print "hello"
       self.assertEqual(s.getvalue(), "hello")
    Rs(R#(((s-/usr/lib64/python2.7/test/support/__init__.pyR$�scCs
td�S(NR�(R#(((s-/usr/lib64/python2.7/test/support/__init__.pytcaptured_stderr�scCs
td�S(Ntstdin(R#(((s-/usr/lib64/python2.7/test/support/__init__.pytcaptured_stdin�scCs8tj�tr tjd�ntj�tj�dS(s�Force as many objects as possible to be collected.

    In non-CPython implementations of Python, this is needed because timely
    deallocation is not guaranteed by the garbage collector.  (Even in CPython
    this can be the case in case of reference cycles.)  This means that __del__
    methods may be called later than expected and weakrefs may remain alive for
    longer than expected.  This function tries its best to force all garbage
    objects to disappear.
    g�������?N(tgctcollectRR�R�(((s-/usr/lib64/python2.7/test/support/__init__.pyt
gc_collect�s



t2PtgettotalrefcounttPcCstjt|d�S(Nt0P(tstructtcalcsizet_header(tfmt((s-/usr/lib64/python2.7/test/support/__init__.pytcalcobjsize�scCstjt|d�S(NR�(R�R�t_vheader(R�((s-/usr/lib64/python2.7/test/support/__init__.pytcalcvobjsize�sii	cCs�ddl}tj|�}t|�tkr:|jt@s_t|�tkrot|�jt@ro||j7}ndt|�||f}|j|||�dS(Ni����s&wrong size for %s: got %d, expected %d(	t	_testcapiRNt	getsizeofRot	__flags__t_TPFLAGS_HEAPTYPEt_TPFLAGS_HAVE_GCtSIZEOF_PYGC_HEADRJ(ttesttotsizeR�R�RL((s-/usr/lib64/python2.7/test/support/__init__.pytcheck_sizeofs%cs��fd�}|S(Ncs1���fd�}�j|_�j|_|S(Ncs�y.ddl}t|��}|j|�}Wn$tk
rD�nAd}}n1Xx-�D]%}y|j||�PWq\q\Xq\Wz�||�SWd|r�|r�|j||�nXdS(Ni����(tlocaleRgt	setlocaleRhRY(R{tkwdsR�tcategorytorig_localetloc(tcatstrRztlocales(s-/usr/lib64/python2.7/test/support/__init__.pytinners$

(t	func_nameR>(RzR�(R�R�(Rzs-/usr/lib64/python2.7/test/support/__init__.pyR�s((R�R�R�((R�R�s-/usr/lib64/python2.7/test/support/__init__.pyR'scs�fd�}|S(Ncs.��fd�}�j|_�j|_|S(Ncs�y
tj}Wn tk
r/tjd��nXdtjkrOtjd}nd}�tjd<|�z�||�SWd|dkr�tjd=n
|tjd<tj�XdS(Nstzset requiredtTZ(R�ttzsetRhRGRHRuR�RY(R{R�R�torig_tz(Rzttz(s-/usr/lib64/python2.7/test/support/__init__.pyR�;s




(R<R>(RzR�(R�(Rzs-/usr/lib64/python2.7/test/support/__init__.pyR�:s((R�R�((R�s-/usr/lib64/python2.7/test/support/__init__.pyR:9scCs�idd6td6td6dtd6}tjd|tjtjB�}|dkrgtd|f��ntt	|j
d��||j
d	�j��}|a|t
kr�t
}n|tdkr�td
|f��n|adS(NiR�tmtgtts(\d+(\.\d+)?) (K|M|G|T)b?$sInvalid memory limit %riis$Memory limit %r too low to be useful(t_1Mt_1GRsRtt
IGNORECASEtVERBOSERYR�R�Rtgrouptlowertreal_max_memusetMAX_Py_ssize_tt_2GR(tlimittsizesR�tmemlimit((s-/usr/lib64/python2.7/test/support/__init__.pyR(bs 2	ics���fd�}|S(sQDecorator for bigmem tests.

    'minsize' is the minimum useful size for the test (in arbitrary,
    test-interpreted units.) 'memuse' is the number of 'bytes per size' for
    the test, or a good estimate of it. 'overhead' specifies fixed overhead,
    independent of the testsize, and defaults to 5Mb.

    The decorator tries to guess a good value for 'size' and passes it to
    the decorated test function. If minsize * memuse is more than the
    allowed memory use (as defined by max_memuse), the test is skipped.
    Otherwise, minsize is adjusted upward to use up to max_memuse.
    cs7����fd�}�|_�|_�|_|S(Ncs�ts.d}|j|��dtk�n^tt���}|�krutrqtjjd�jf�ndSt	|dt��}�||�S(Niis)Skipping %s because of memory constraint
i2(
RtassertFalseR�R�RRNR�R[R<tmax(Ratmaxsize(Rtmemusetminsizetoverhead(s-/usr/lib64/python2.7/test/support/__init__.pyR��s"(R�R�R�(RR�(R�R�R�(Rs-/usr/lib64/python2.7/test/support/__init__.pyR��s
			((R�R�R�R�((R�R�R�s-/usr/lib64/python2.7/test/support/__init__.pyR)ws
cs����fd�}|S(Ncs7����fd�}�|_�|_�|_|S(Ncsftsd}n�}ts"�rYt|�krYtrUtjjd�jf�ndS�||�S(Nis)Skipping %s because of memory constraint
(R�RRNR�R[R<(RaR�(tdry_runRR�R�(s-/usr/lib64/python2.7/test/support/__init__.pyR��s	
(R�R�R�(RR�(RR�R�R�(Rs-/usr/lib64/python2.7/test/support/__init__.pyR��s
			((R�R�R�RR�((RR�R�R�s-/usr/lib64/python2.7/test/support/__init__.pytprecisionbigmemtest�scs�fd�}|S(s0Decorator for tests that fill the address space.cs@ttkr2tr<tjjd�jf�q<n
�|�SdS(Ns)Skipping %s because of memory constraint
(RR�RRNR�R[R<(Ra(R(s-/usr/lib64/python2.7/test/support/__init__.pyR��s
((RR�((Rs-/usr/lib64/python2.7/test/support/__init__.pyR*�scBseZd�ZRS(cCstj�}||�|S(N(RGt
TestResult(RaR�R�((s-/usr/lib64/python2.7/test/support/__init__.pytrun�s
(R<R=R(((s-/usr/lib64/python2.7/test/support/__init__.pyR+�scCs|S(N((Rp((s-/usr/lib64/python2.7/test/support/__init__.pyt_id�scCsP|dkr&t�r&tjtj�St|�r6tStjdj|��SdS(NR�sresource {0!r} is not enabled(R�RGtskipR�RRR�(R�((s-/usr/lib64/python2.7/test/support/__init__.pytrequires_resource�s
cCstdt�|�S(s9
    Decorator for tests only applicable on CPython.
    tcpython(timpl_detailRV(R�((s-/usr/lib64/python2.7/test/support/__init__.pyR2�scKs}t|�rtS|dkrpt|�\}}|r=d}nd}t|j��}|jdj|��}ntj	|�S(Ns*implementation detail not available on {0}s%implementation detail specific to {0}s or (
R3RRYt
_parse_guardstsortedR�R�R�RGR(RLtguardst
guardnamestdefault((s-/usr/lib64/python2.7/test/support/__init__.pyR�s	cCsW|sitd6tfS|j�d}|j�|gt|�ksLt�||fS(NRi(RVRXtvaluesR�Rx(Rtis_true((s-/usr/lib64/python2.7/test/support/__init__.pyR	�s
%cKs.t|�\}}|jtj�j�|�S(s5This function returns True or False depending on the host platform.
       Examples:
          if check_impl_detail():               # only on CPython (default)
          if check_impl_detail(jython=True):    # only on Jython
          if check_impl_detail(cpython=False):  # everywhere except on CPython
    (R	RoR�tpython_implementationR�(RR
((s-/usr/lib64/python2.7/test/support/__init__.pyR3�scCsrg}x\|jD]Q}t|tj�rEt||�|j|�q||�r|j|�qqW||_dS(s>Recursively filter test cases in a suite based on a predicate.N(t_testsRiRGt	TestSuitet
_filter_suiteR\(tsuitetpredtnewtestsR�((s-/usr/lib64/python2.7/test/support/__init__.pyR�s
cCs�tr'tjtjdddt�}n	t�}|j|�}|jr\|j	r\t
�n|j�s�t|j
�dkr�|jr�|j
dd}nLt|j�dkr�|j
r�|jdd}nd}ts�|d7}nt|��ndS(	s2Run tests from a unittest.TestSuite-derived class.t	verbosityitfailfastiismultiple errors occurreds!; run in verbose mode for detailsN(RRGtTextTestRunnerRNRsRR+RttestsRuntskippedRt
wasSuccessfulR�terrorstfailuresR(RtrunnerR�R|((s-/usr/lib64/python2.7/test/support/__init__.pyt
_run_suites 		
cCs$tdkrtSt|j��SdS(N(t_match_test_funcRYRVtid(R�((s-/usr/lib64/python2.7/test/support/__init__.pyt
match_test#scCsd|kotjd|�S(NRMs[?*\[\]](Rstsearch(tpattern((s-/usr/lib64/python2.7/test/support/__init__.pyt_is_full_match_test+scs�|tkrdS|s%d}d}nittt|��rLt|�j}nBdjttj	|��}t
j|�j��fd�}|}t
|�a|adS(Nt|cs0�|�rtStt�|jd���SdS(NRM(RVtanyR�R�(ttest_id(tregex_match(s-/usr/lib64/python2.7/test/support/__init__.pytmatch_test_regexJs((t_match_test_patternsRYtallR�R&R�t__contains__R�tfnmatcht	translateRsRHRtR�R!(tpatternsRztregexR+((R*s-/usr/lib64/python2.7/test/support/__init__.pytset_match_tests5s	cGs�tjtjf}tj�}x�|D]�}t|t�rx|tjkri|jtjtj|��q�t	d��q%t||�r�|j|�q%|jtj
|��q%Wt|t�t
|�dS(s1Run tests from unittest.TestCase-derived classes.s)str arguments must be keys in sys.modulesN(RGRtTestCaseRiRIRNROtaddTestt
findTestCasesR�t	makeSuiteRR#R (tclassestvalid_typesRtcls((s-/usr/lib64/python2.7/test/support/__init__.pyR,]s
 
Rtwin32tWITH_DOC_STRINGSstest requires docstringscCs�ddl}|dkr!t}nd}tj}t�t_z>|j|d|�\}}|rytd||f��nWd|t_Xtr�d|j|fGHn||fS(s
Run doctest on the given module.  Return (#failures, #tests).

    If optional argument verbosity is not specified (or is None), pass
    test.support's belief about verbosity on to doctest.  Else doctest's
    usual behavior is used (it searches sys.argv for -v).
    i����NRs%d of %d doctests faileds,doctest (%s) ... %d tests with zero failures(	tdoctestRYRRNRsR	ttestmodRR<(ReRR=tsave_stdoutRR�((s-/usr/lib64/python2.7/test/support/__init__.pyR-|s		
cCstrtj�fSdSdS(Ni(i(tthreadt_count(((s-/usr/lib64/python2.7/test/support/__init__.pyR.�s
cCsTts
dSd}x=t|�D]/}tj�}||kr?Pntjd�qWdS(Ni
g�������?(R@RRAR�R�(t
nb_threadst
_MAX_COUNTtcountR�((s-/usr/lib64/python2.7/test/support/__init__.pyR/�scs,ts
�Stj���fd��}|S(s�Use this function when threads are being used.  This will
    ensure that the threads are cleaned up even when the test fails.
    If threading is unavailable this function does nothing.
    cs)t�}z�|�SWdt|�XdS(N(R.R/(R{tkey(Rz(s-/usr/lib64/python2.7/test/support/__init__.pyR��s	(R@R�R�(RzR�((Rzs-/usr/lib64/python2.7/test/support/__init__.pyR0�sgN@ccs�tj�}z	dVWdtj�}||}x�tr�tj�}||krSPntj�|kr�tj�|}d|||||f}t|��ntjd�t�q1WXdS(sE
    bpo-31234: Context manager to wait until all threads created in the with
    statement exit.

    Use thread.count() to check if threads exited. Indirectly, wait until
    threads exit the internal t_bootstrap() C function of the thread module.

    threading_setup() and threading_cleanup() are designed to emit a warning
    if a test leaves running threads in the background. This context manager
    is designed to cleanup threads started by the thread.start_new_thread()
    which doesn't allow to wait for thread exit, whereas thread.Thread has a
    join() method.
    NsYwait_threads() failed to cleanup %s threads after %.1f seconds (count: %s, old count: %s)g{�G�z�?(R@RAR�RVRxR�R�(R�t	old_countt
start_timetdeadlineRDtdtRL((s-/usr/lib64/python2.7/test/support/__init__.pytwait_threads_exit�s 	
	
cCscttd�r_d}xGtr[y/tj|tj�\}}|dkrLPnWqPqXqWndS(s�Use this function at the end of test_main() whenever sub-processes
    are started.  This will help ensure that no extra children (zombies)
    stick around to hog resources and create problems when looking
    for refleaks.
    twaitpidi����iN(R�RuRVRKtWNOHANG(tany_processR+tstatus((s-/usr/lib64/python2.7/test/support/__init__.pyR7�s		c	cs�t|�}g}zfy,x%|D]}|j�|j|�qWWn.trkdt|�t|�fGHn�nXdVWd|r�|�ntj�}}x�tdd�D]�}|d7}x.|D]&}|jt|tj�d��q�Wg|D]}|j	�r�|^q�}|sPntr�dt|�|fGHq�q�WXg|D]}|j	�rE|^qE}|r�t
dt|���ndS(Ns/Can't start %d threads, only %d threads startediii<g{�G�z�?s7Unable to join %d threads during a period of %d minutessUnable to join %d threads(RQtstartR\RR�R�RR�R�tisAliveRx(tthreadstunlocktstartedR�tendtimet	starttimeR�((s-/usr/lib64/python2.7/test/support/__init__.pyR1s:

	


$%%ccs�t||�rNt||�}t|||�z	|VWdt|||�Xn<t|||�z	dVWdt||�r�t||�nXdS(s�Temporary swap out an attribute with a new object.

    Usage:
        with swap_attr(obj, "attr", 5):
            ...

        This will set obj.attr to 5 for the duration of the with: block,
        restoring the old value at the end of the block. If `attr` doesn't
        exist on `obj`, it will be created and then deleted at the end of the
        block.

        The old value (or None if it doesn't exist) will be assigned to the
        target of the "as" clause, if there is one.
    N(R�RgR�tdelattr(RpRftnew_valtreal_val((s-/usr/lib64/python2.7/test/support/__init__.pyt	swap_attr)s		ccsk||kr:||}|||<z	|VWd|||<Xn-|||<z	dVWd||krf||=nXdS(s�Temporary swap out an item with a new object.

    Usage:
        with swap_item(obj, "item", 5):
            ...

        This will set obj["item"] to 5 for the duration of the with: block,
        restoring the old value at the end of the block. If `item` doesn't
        exist on `obj`, it will be created and then deleted at the end of the
        block.

        The old value (or None if it doesn't exist) will be assigned to the
        target of the "as" clause, if there is one.
    N((RptitemRWRX((s-/usr/lib64/python2.7/test/support/__init__.pyt	swap_itemHs

	
	cCs\y|j�SWnGtk
rWydjd�|D��SWqXtk
rSt|�SXnXdS(sZEmulate the py3k bytes() constructor.

    NOTE: This is only a best effort function.
    R�css|]}t|�VqdS(N(tchr(t.0R((s-/usr/lib64/python2.7/test/support/__init__.pys	<genexpr>rsN(ttobytesRhR�t	TypeErrortbytes(tb((s-/usr/lib64/python2.7/test/support/__init__.pyR5gs

t	getcountss-types are immortal if COUNT_ALLOCS is definedcCsddl}|j�S(sZReturn a list of command-line arguments reproducing the current
    settings in sys.flags.i����N(t
subprocesst_args_from_interpreter_flags(Rc((s-/usr/lib64/python2.7/test/support/__init__.pytargs_from_interpreter_flagsyscCstjdd|�j�}|S(s�Strip the stderr of a Python process from potential debug output
    emitted by the interpreter.

    This will typically be run on the result of the communicate() method
    of a subprocess.Popen object.
    s\[\d+ refs\]\r?\n?$R�(Rstsubtstrip(R�((s-/usr/lib64/python2.7/test/support/__init__.pyR8scsid|f��fd��Y}tg�|||���|jtt��t�|j�d�dS(NtAcseZ��fd�ZRS(cs0t�d<yt��Wntk
r+nXdS(Ni(RVtnextt
StopIteration(Ra(tdonetit(s-/usr/lib64/python2.7/test/support/__init__.pyt__del__�s


(R<R=Rm((RkRl(s-/usr/lib64/python2.7/test/support/__init__.pyRh�si(RXtassertRaisesRjRiR�t
assertTrue(R�titerR:R{Rh((RkRls-/usr/lib64/python2.7/test/support/__init__.pytcheck_free_after_iterating�s	ccs:tj�}tj�z	dVWd|r5tj�nXdS(N(R�t	isenabledtdisabletenable(thave_gc((s-/usr/lib64/python2.7/test/support/__init__.pyt
disable_gc�s
	cCsTtjd�pd}d}x,|j�D]}|jd�r(|}q(q(W|dkS(s,Find if Python was built with optimizations.t	PY_CFLAGSR�s-Os-O0s-Og(R�s-O0s-Og(t	sysconfigtget_config_varR�RR(tcflagst	final_opttopt((s-/usr/lib64/python2.7/test/support/__init__.pytpython_is_optimized�s
cBs,eZdZdZdZd�Zd�ZRS(s�Try to prevent a crash report from popping up.

    On Windows, don't display the Windows Error Reporting dialog.  On UNIX,
    disable the creation of coredump file.
    cCstjjd�r�ddl}|jj|_d}|jj|�|_|jj|j|B�yddl	}|j
Wnttfk
r�qXi|_
x|j|j|jgD]C}|j
||j�}|j||j�}||f|j
|<q�Wnyddl}Wntk
r%d}nX|dk	r�y9|j|j�|_|j|jd|jdf�Wq�ttfk
r�q�Xntjdkrddl}dd	d
dg}	|j|	d|jd
|j�}
|
j�d}|j�dkrtj j!d�tj j"�qn|S(s�On Windows, disable Windows Error Reporting dialogs using
        SetErrorMode.

        On UNIX, try to save the previous core file size limit, then set
        soft limit to 0.
        R~i����NiiiR�s/usr/bin/defaultsRZscom.apple.CrashReportert
DialogTypeRsR�t	developers:this test triggers the Crash Reporter, that is intentional(#RNR�RRR�R�tkernel32t_k32tSetErrorModet	old_valueR�tCrtSetReportModeRhRFt	old_modestCRT_WARNt	CRT_ERRORt
CRT_ASSERTtCRTDBG_MODE_FILEtCrtSetReportFiletCRTDBG_FILE_STDERRR�RYt	getrlimittRLIMIT_COREt	setrlimitR�R�RctPopentPIPEtcommunicateRgRsR[tflush(RaR�tSEM_NOGPFAULTERRORBOXR�treport_typetold_modetold_fileR�RctcmdtprocRs((s-/usr/lib64/python2.7/test/support/__init__.pyR��sV				

	cGs�|jdkrdStjjd�r�|jj|j�|jr�ddl}xF|jj	�D]2\}\}}|j
||�|j||�q]Wq�n@ddl}y|j
|j|j�Wnttfk
r�nXdS(sARestore Windows ErrorMode or core file behavior to initial value.NR~i����(R�RYRNR�RRR�R�R�R�R]R�R�R�R�R�R�R�(RaR�R�R�R�R�R�((s-/usr/lib64/python2.7/test/support/__init__.pyR�s	"N(R<R=R>RYR�R�R�R�(((s-/usr/lib64/python2.7/test/support/__init__.pyR;�s
	GcCs*ddl}t��|j�WdQXdS(s�Deliberate crash of Python.

    Python can be killed by a segmentation fault (SIGSEGV), a bus error
    (SIGBUS), or a different error depending on the platform.

    Use SuppressCrashReport() to prevent a crash report from popping up.
    i����N(R�R;t
_read_null(R�((s-/usr/lib64/python2.7/test/support/__init__.pyt
_crash_pythons	
c
Cs�tjjd�rdy!tjd�}t|�dSWqdtk
r`}|jtjkra�qaqdXnd}t	td�r�ytj
d�}Wq�tk
r�q�Xnd
}tjdkr+yd	d
l}|j
Wnttfk
r�q+Xi}x9|j|j|jfD]}|j
|d�||<qWnzyd}xlt|�D]^}ytj|�}Wn+tk
r�}	|	jtjkr��q�qAXtj|�|d7}qAWWd
|d
k	r�x7|j|j|jfD]}|j
|||�q�WnX|S(
s/Count the number of open file descriptors.
    tlinuxtfreebsds
/proc/self/fdiitsysconftSC_OPEN_MAXR;i����Ni(R�R�(RNR�RRRuR�R�R�R�R�R�R�RYtmsvcrtR�RhRFR�R�R�RtduptEBADFR�(
tnamesR�tMAXFDR�R�R�RDtfdtfd2R�((s-/usr/lib64/python2.7/test/support/__init__.pytfd_count#sR

	

	tSaveSignalscBs)eZdZd�Zd�Zd�ZRS(s�
    Save an restore signal handlers.

    This class is only able to save/restore signal handlers registered
    by the Python signal module: see bpo-13285 for "external" signal
    handlers.
    cCs�ddl}||_ttd|j��|_xHdD]@}yt||�}Wntk
rfq7nX|jj|�q7Wi|_dS(Ni����itSIGKILLtSIGSTOP(R�R�(	tsignalRQRtNSIGtsignalsRgRhRwthandlers(RaR�tsignametsignum((s-/usr/lib64/python2.7/test/support/__init__.pyRchs	

cCsIxB|jD]7}|jj|�}|dkr4q
n||j|<q
WdS(N(R�R�t	getsignalRYR�(RaR�thandler((s-/usr/lib64/python2.7/test/support/__init__.pytsaveus
cCs7x0|jj�D]\}}|jj||�qWdS(N(R�R]R�(RaR�R�((s-/usr/lib64/python2.7/test/support/__init__.pytrestore�s(R<R=R>RcR�R�(((s-/usr/lib64/python2.7/test/support/__init__.pyR�_s	
	((ii@i@i@ii(i@ii(((((�R>R<RFt
contextlibR�R/R�R�R�RwRNRuR�R�R@RGREtUserDictRsR�R�RxRjR@RYt__all__t
SHORT_TIMEOUTR�RRRRHRtcontextmanagerRVRDRXRRUR[R6R4RRRR�RRrRR	R
R}RRR�R�R�R�RR�RR
R�RRRRRR�R�RRRR9R
RRt
PIPE_MAX_SIZEt
SOCK_MAX_SIZERRRt	NameErrort
skipUnlesstrequires_unicodeRtFS_NONASCIItunichrt	characterR$R%tdecodetUnicodeErrorRJRRitTESTFN_UNICODEtTESTFN_ENCODINGR�RtTESTFN_UNENCODABLEtevalR&R�R(t
TEST_HTTP_URLR-RR,R0RRyR�tabspatht__file__tTEST_SUPPORT_DIRR6R�RXRRRDRRtobjectR^R�RR R!t	DictMixinR"R�R%R&R#R$R�R�R�R�R�R�R�R�R�R�R'R:R�R�R�t_4GR�R�R(R)RR*R+RRR2RR	R3RR R!R,R#R&R3R,RytHAVE_DOCSTRINGStrequires_docstringsR-tenvironment_alteredR.R/R0RJR7R1RYR[R5tskipIftrequires_type_collectingReR8RqRvR}R;R�R�R�(((s-/usr/lib64/python2.7/test/support/__init__.pyt<module>s�

								
	
	
&					
!										J			<$			
	


												

				
	.			*' /D					

				$	"


		'				
	
					
	(			&
			#	 					
e		<support/script_helper.pyo000064400000013443150327172240011664 0ustar00�
{fc@s.ddlZddlZddlZddlZddlZddlZddlZddlZddlZyddl	Z	Wne
k
r�nXddlmZd�Z
d�Zd�Zd�Zd�Zd�Zd	�Zejd
��Zd�Zd�Zdd
�Zdd�Zded�ZdS(i����N(tstrip_python_stderrc	
Ostjg}|s"|jd�n|j|�tjj�}|j|�tj	|dtj
dtj
dtj
d|�}z|j�\}}Wdtj�|j
j�|jj�X|j}t|�}|r�|s�|r
|r
td||jdd�f��n|||fS(	Ns-Etstdintstdouttstderrtenvs-Process return code is %d, stderr follows:
%stasciitignore(tsyst
executabletappendtextendtostenvirontcopytupdatet
subprocesstPopentPIPEtcommunicatet_cleanupRtcloseRt
returncodeRtAssertionErrortdecode(	texpected_successtargstenv_varstcmd_lineRtptoutterrtrc((s2/usr/lib64/python2.7/test/support/script_helper.pyt_assert_pythons*

	

	cOstt||�S(s�
    Assert that running the interpreter with `args` and optional environment
    variables `env_vars` is ok and return a (return code, stdout, stderr) tuple.
    (R tTrue(RR((s2/usr/lib64/python2.7/test/support/script_helper.pytassert_python_ok2scOstt||�S(s�
    Assert that running the interpreter with `args` and optional environment
    variables `env_vars` fails and return a (return code, stdout, stderr) tuple.
    (R tFalse(RR((s2/usr/lib64/python2.7/test/support/script_helper.pytassert_python_failure9sc
GsWtjdg}|j|�ttjd��#}tj|d|dtj�SWdQXdS(Ns-EtwRR(	RRR
topenRtdevnullRtcalltSTDOUT(RRR'((s2/usr/lib64/python2.7/test/support/script_helper.pytpython_exit_code@s

c	OsGtjdg}|j|�tj|dtjdtjdtj|�S(Ns-ERRR(RRR
RRRR)(RtkwargsR((s2/usr/lib64/python2.7/test/support/script_helper.pytspawn_pythonGs

cCsA|jj�|jj�}|jj�|j�tj�|S(N(RRRtreadtwaitRR(Rtdata((s2/usr/lib64/python2.7/test/support/script_helper.pytkill_pythonNs



cOs.td||�}t|�}|j�|fS(Ns-O(R,R0R.(RR+Rtstdout_data((s2/usr/lib64/python2.7/test/support/script_helper.pyt
run_pythonXsccs<tj�}tjj|�}z	|VWdtj|�XdS(N(ttempfiletmkdtempRtpathtrealpathtshutiltrmtree(tdirname((s2/usr/lib64/python2.7/test/support/script_helper.pyttemp_diras
	cCsP|tjd}tjj||�}t|d�}|j|�|j�|S(NtpyR%(RtextsepR5tjoinR&twriteR(t
script_dirtscript_basenametsourcetscript_filenametscript_nametscript_file((s2/usr/lib64/python2.7/test/support/script_helper.pytmake_scriptjs

cCs!tj|dt�|d}|S(Ntdoraiseto(t
py_compiletcompileR!(RCt
compiled_name((s2/usr/lib64/python2.7/test/support/script_helper.pytcompile_scriptrs
cCs�|tjd}tjj||�}tj|d�}|dkrYtjj|�}n|j||�|j	�|tjj||�fS(NtzipR%(
RR<R5R=tzipfiletZipFiletNonetbasenameR>R(tzip_dirtzip_basenameRCtname_in_ziptzip_filenametzip_nametzip_file((s2/usr/lib64/python2.7/test/support/script_helper.pytmake_zip_scriptzs
tcCs!tj|�t|d|�dS(Nt__init__(RtmkdirRE(tpkg_dirtinit_source((s2/usr/lib64/python2.7/test/support/script_helper.pytmake_pkg�s
icCs�g}t|dd�}|j|�tjj|�}	t|||�}
|j|
�|r�t|�}t|
�}
|j||
f�ngtd|d�D]}tjj	|g|�^q�}tjj	|dtjj|
��}
|tj
d}tjj	||�}tj|d�}x3|D]+}tjj	||	�}|j
||�q'W|j
|
|
�|j�x|D]}tj|�qwW|tjj	||
�fS(NRYRXii����RLR%(RER	RR5RPRKR
trangetsepR=R<RMRNR>Rtunlink(RQRRtpkg_nameR@RAtdepthtcompiledR`t	init_namet
init_basenameRCtit	pkg_namestscript_name_in_zipRTRURVtnametinit_name_in_zip((s2/usr/lib64/python2.7/test/support/script_helper.pytmake_zip_pkg�s.

9%


(RRtretos.pathR3RRHt
contextlibR7RMtImportErrorttest.supportRR R"R$R*R,R0R2tcontextmanagerR:RERKRORWR]R#Rk(((s2/usr/lib64/python2.7/test/support/script_helper.pyt<module>s4
						
					test_support.pyc000064400000000401150327172240010032 0ustar00�
zfc@s,ddlZddlZejejd<dS(i����Nstest.test_support(tsysttest.supportttesttsupporttmodules(((s)/usr/lib64/python2.7/test/test_support.pyt<module>s__init__.pyc000064400000000174150327172240007025 0ustar00�
zfc@sdS(N((((s%/usr/lib64/python2.7/test/__init__.pyt<module>tscript_helper.pyo000064400000000272150327172240010144 0ustar00�
zfc@sddlTdS(i����(t*N(ttest.support.script_helper(((s*/usr/lib64/python2.7/test/script_helper.pyt<module>t__pycache__/__init__.cpython-36.opt-2.pyc000064400000000170150327172730014106 0ustar003


 \/�@sdS)N�rrr�%/usr/lib64/python3.6/test/__init__.py�<module>s__pycache__/__init__.cpython-36.pyc000064400000000170150327172730013146 0ustar003


 \/�@sdS)N�rrr�%/usr/lib64/python3.6/test/__init__.py�<module>s__pycache__/__init__.cpython-36.opt-1.pyc000064400000000170150327172730014105 0ustar003


 \/�@sdS)N�rrr�%/usr/lib64/python3.6/test/__init__.py�<module>ssupport/__pycache__/__init__.cpython-36.opt-2.pyc000064400000160126150327172730015632 0ustar003

�\dh����@sX
edkred��ddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
ZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z!ddl"Z"ddl#m$Z$yddl%Z%ddl&Z&Wnek
�r>dZ%dZ&YnXyddl'Z(Wnek
�rfdZ(YnXyddl)Z)Wnek
�r�dZ)YnXyddl*Z*Wnek
�r�dZ*YnXyddl+Z+Wnek
�r�dZ+YnXyddl,Z,Wnek
�rdZ,YnXyddl-Z-Wnek
�r.dZ-YnXyddl.Z.Wnek
�rVdZ.YnXdddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dag\Z/Gdbd�de0�Z1Gdcd�de1�Z2Gddd
�d
e1�Z3Gded�dej4�Z5ej6�dedgdh��Z7�dffdj�dkd�Z8dldm�Z9dndo�Z:dpd<�Z;dqd=�Z<ffdifdrd�Z=dsd8�Z>dZ?dZ@daAdaBdZCdiZDdaEdtd�ZFdud�ZGdvd�ZHdwdx�ZIejjJdy��r*�dgdzd{�ZKd|d}�ZLd~d�ZMd�d��ZNd�d��ZOnejPZLejQZMd�d��ZNd�d��ZOd�d�ZPd�d��ZQd�d�ZRd�d��ZSd�d�ZTd�d��ZUd�d"�ZV�dhd�d#�ZWd�d��ZXd�d$�ZYd�d%�ZZd�d&�Z[�did�d'�Z\d�Z]d�Z^ej_ej`fd�dI�Zae]fd�dJ�Zbd�dL�Zcd�d��Zded�Zed�d��Zf�dlZg�doZhejiejjkd��jJd��d��Zlejie)d��Zmejie*d��Znejie+d��Zoejie,d��ZpejjJd��Zqejrd��Zsesdk	�otesdkZtejd�k�r�et�r�d�nd�ZundZuejvd�k�r�d�Zwnd�Zwd�jxewejy��ZwdZzxL�dpD]BZ{yej|ej}e{��e{k�r�e~�Wne~k
�rYnXe{ZzP�q�Wewd�Zejd�k�r6ddl�Z�e�j�d�e�Zej��Z�dZ�ejvd�k�r�ej��jd�k�r�ewd�Z�ye�j�e��Wne�k
�r�YnXe�d�e�e�f�dZ�nBejd�k�r�yd�j�e��Wn&e�k
�r�ewd�j�e�dƃZ�YnXdZ�xF�dqD]<Zvyevj�e��Wn&e�k
�r(ej}ew�evZ�PYnX�q�Wez�rDewd�ezZ�ndZ�ej��Z�diZ�diZ�ej6�drd�d̈́�Z�ej6�dsd�dτ�Z�ej6�dtd�d��Z�e�ed҃�r�ej6d�dM��Z�ej�j�ej�j�e���Z�ej�j�e��Z�ej�j�e�dԃZ��dud�d�Z�d�d�Z�d�d]�Z�d�dلZ�dddڜd�d(�Z�d�dK�Z�Gd�dބd�e��Z��dvd�d�Z�ej6d�dT��Z�ej6d�e�difd�d��Z�ej6d�dU��Z�Gd�d�de��Z�Gd�dV�dVej�j��Z�Gd�d�d�e��Z�Gd�d)�d)e��Z�e�e�ej�d�Z�e�e�ej�d�Z�e�e�ej�d�Z�ej6d�fd�d�d-��Z�ej6d�d��Z�d�d�Z�d�d�Z�d�d�Z�d�d��Z�ej6d�d���Z�d�d��Z�d�Z�d�Z�e�ed���	rHd�e�Z�d�Z�e�d�Z��d�d�Zd�d�ZÐdwZĐdxZŐd�d�ZƐddW�Zǐd	d^�ZȐdyZ�d�e�Z�d�e�Z�d�e�Z�ej�Zΐd
d[�Z�G�d�d��d�ZАdz�d
d5�Zѐdd6�Z�G�dd.�d.�ZӐd�d�ZԐd�d�ZՐdd@�Z֐dd7�Zאd{�d�d�Z�daِddA�Zڐd�d�ZېddD�Zܐd�d�Zݐd�d�Zސd �d!�Zߐd"�d#�Z�da�da�d$�d%�Z�d&�d'�Z�d(�d)�Z�d*d/�Z�d+�d,�Z�e܃�
o�ejd�k�
o�ejr�d-�Z�e�j�dk	�oe�Z�ejie�d.�Z�d|�d/d0�Z�d0�d1�Z�d2�d3�Z�diZ�d4dP�Z�d5dQ�Z�d6dR�Z�ej6�d}�d8�d9��Z�d:dN�Z�ej6�d~�d;dS��Z�ej6�d<dY��Z�ej6�d=dX��Z��d>�d?�Z�ej�e�e�d@��dA�Z��dB�dC�Z��dD�dE�Z�G�dFdO�dOej�j��Z�G�dGdZ�dZe���Zd�a�dHd ��Z�dId1��Zd�a�dJ�dK��Z�dLd:��Z�dM�dN��Z�dOd!��Zf�dP��dQd>��Z	dfff�dRd?��Z
G�dSd\�d\��Z�dT�dU��Z�dV�dW��Z
ff�dX�dY��Zgf�dZd`��Zd�a�d[dF��Zej6�d\�d]���Z�d^da��ZG�d_�d`��d`��ZG�da�db��db��Zej6�dc�dd���ZdS(ztest.supportz.support must be imported from the test package�N�)�get_test_runner�
PIPE_MAX_SIZE�verbose�
max_memuse�
use_resources�failfast�Error�
TestFailed�
TestDidNotRun�ResourceDenied�
import_module�import_fresh_module�CleanImport�unload�forget�record_original_stdout�get_original_stdout�captured_stdout�captured_stdin�captured_stderr�TESTFN�SAVEDCWD�unlink�rmtree�temp_cwd�findfile�create_empty_file�can_symlink�fs_is_case_insensitive�is_resource_enabled�requires�requires_freebsd_version�requires_linux_version�requires_mac_ver�requires_hashdigest�check_syntax_error�TransientResource�time_out�socket_peer_reset�ioerror_peer_reset�transient_internet�BasicTestRunner�run_unittest�run_doctest�skip_unless_symlink�
requires_gzip�requires_bz2�
requires_lzma�
bigmemtest�bigaddrspacetest�cpython_only�
get_attribute�requires_IEEE_754�skip_unless_xattr�
requires_zlib�anticipate_failure�load_package_tests�detect_api_mismatch�check__all__�requires_android_level�requires_multiprocessing_queue�	is_jython�
is_android�check_impl_detail�
unix_shell�setswitchinterval�HOST�IPV6_ENABLED�find_unused_port�	bind_port�open_urlresource�bind_unix_socket�
temp_umask�
reap_children�TestHandler�threading_setup�threading_cleanup�reap_threads�
start_threads�check_warnings�check_no_resource_warning�EnvironmentVarGuard�run_with_locale�	swap_item�	swap_attr�Matcher�set_memlimit�SuppressCrashReport�sortdict�run_with_tz�PGO�missing_compiler_executable�fd_countc@seZdZdS)r	N)�__name__�
__module__�__qualname__�rcrc�-/usr/lib64/python3.6/test/support/__init__.pyr	|sc@seZdZdS)r
N)r`rarbrcrcrcrdr
sc@seZdZdS)rN)r`rarbrcrcrcrdr�sc@seZdZdS)rN)r`rarbrcrcrcrdr�sTccs8|r.tj��tjddt�dVWdQRXndVdS)N�ignorez.+ (module|package))�warnings�catch_warnings�filterwarnings�DeprecationWarning)rercrcrd�_ignore_deprecated_imports�s
rjF)�required_oncCsft|��Ty
tj|�Stk
rV}z&tjjt|��r8�tj	t
|���WYdd}~XnXWdQRXdS)N)rj�	importlibr
�ImportError�sys�platform�
startswith�tuple�unittest�SkipTest�str)�name�
deprecatedrk�msgrcrcrdr
�s	

cCs^|tjkrt|�tj|=x>ttj�D]0}||ks@|j|d�r&tj|||<tj|=q&WdS)N�.)rn�modules�
__import__�listrp)ru�orig_modules�modnamercrcrd�_save_and_remove_module�s
r~cCs>d}ytj|||<Wntk
r.d}YnXdtj|<|S)NTF)rnry�KeyError)rur|Zsavedrcrcrd�_save_and_block_module�s

r�cCs|r
tjSdd�S)NcSs|S)Nrc)�frcrcrd�<lambda>�sz$anticipate_failure.<locals>.<lambda>)rrZexpectedFailure)Z	conditionrcrcrdr:�scCsF|dkrd}tjjtjjtjjt���}|j|||d�}|j|�|S)Nztest*)Z	start_dirZ
top_level_dir�pattern)�os�path�dirname�__file__ZdiscoverZaddTests)Zpkg_dir�loaderZstandard_testsr�Ztop_dirZ
package_testsrcrcrdr;�s
cCs�t|���i}g}t||�zfyHx|D]}t||�q&Wx |D]}t||�s>|j|�q>Wtj|�}Wntk
r~d}YnXWdx|j�D]\}	}
|
tj	|	<q�Wx|D]}tj	|=q�WX|SQRXdS)N)
rjr~r��appendrlr
rm�itemsrnry)ruZfreshZblockedrvr|Znames_to_removeZ
fresh_nameZblocked_nameZfresh_moduleZ	orig_name�moduleZname_to_removercrcrdr�s$





cCs>yt||�}Wn&tk
r4tjd||f��YnX|SdS)Nzobject %r has no attribute %r)�getattr�AttributeErrorrrrs)�objruZ	attributercrcrdr6s
cCs|adS)N)�_original_stdout)�stdoutrcrcrdr0scCs
tptjS)N)r�rnr�rcrcrcrdr4scCs&ytj|=Wntk
r YnXdS)N)rnryr)rurcrcrdr7scGsny||�Stk
rh}zDtdkrHtd|jj|f�td|j|f�tj|tj�||�Sd}~XnXdS)N�z%s: %szre-run %s%r)	�OSErrorr�print�	__class__r`r��chmod�stat�S_IRWXU)r��func�args�errrcrcrd�
_force_run=sr��wincCs�||�|r|}ntjj|�\}}|p(d}d}x<|dkrjtj|�}|rJ|n||ksVdStj|�|d9}q0Wtjd|tdd�dS)Nrxg����MbP?g�?r�z)tests may fail, delete still pending for �)�
stacklevel)	r�r��split�listdir�time�sleeprf�warn�RuntimeWarning)r��pathname�waitallr�ru�timeout�Lrcrcrd�_waitforHs



r�cCsttj|�dS)N)r�r�r)�filenamercrcrd�_unlinkisr�cCsttj|�dS)N)r�r��rmdir)r�rcrcrd�_rmdirlsr�cs,�fdd��t�|dd�tdd�|�dS)Ncs�x�t|tj|�D]�}tjj||�}ytj|�j}Wn<tk
rn}z td||ft	j
d�d}WYdd}~XnXtj|�r�t
�|dd�t|tj|�qt|tj|�qWdS)Nz-support.rmtree(): os.lstat(%r) failed with %s)�filerT)r�)r�r�r�r��join�lstat�st_moder�r�rn�
__stderr__r��S_ISDIRr�r�r)r�ru�fullname�mode�exc)�
_rmtree_innerrcrdr�ps

z_rmtree.<locals>._rmtree_innerT)r�cSst|tj|�S)N)r�r�r�)�prcrcrdr�sz_rmtree.<locals>.<lambda>)r�)r�rc)r�rd�_rmtreeosr�c
Cs^yddl}Wntk
r Yn:X|jt|�d�}|jjj||t|��}|rZ|d|�S|S)Nrr�)�ctypesrmZcreate_unicode_buffer�len�windll�kernel32ZGetLongPathNameW)r�r��bufferZlengthrcrcrd�	_longpath�s
r�csFytj|�dStk
r"YnX�fdd���|�tj|�dS)Nc
s�x~t|tj|�D]l}tjj||�}ytj|�j}Wntk
rJd}YnXtj	|�rn�|�t|tj
|�qt|tj|�qWdS)Nr)r�r�r�r�r�r�r�r�r�r�r�r)r�rur�r�)r�rcrdr��s

z_rmtree.<locals>._rmtree_inner)�shutilrr�r�r�)r�rc)r�rdr��s
cCs|S)Nrc)r�rcrcrdr��scCs*yt|�Wnttfk
r$YnXdS)N)r��FileNotFoundError�NotADirectoryError)r�rcrcrdr�scCs&yt|�Wntk
r YnXdS)N)r�r�)r�rcrcrdr��sr�cCs&yt|�Wntk
r YnXdS)N)r�r�)r�rcrcrdr�scCsBtjj|�}tjjtjj|��}tjj||d�}tj||�|S)N�c)	rl�util�cache_from_sourcer�r�r��abspathr��rename)�sourceZpyc_fileZup_oneZ
legacy_pycrcrcrd�make_legacy_pyc�s
r�cCs\t|�xNtjD]D}tjj||d�}t|d�x dD]}ttjj||d��q8WqWdS)Nz.pyr��rr�)�optimization)r�rr�)	rrnr�r�r�rrlr�r�)r}r�r��optrcrcrdr�s
cs�ttd�rtjSd}tjjd�r�ddl�ddl�d}d}G�fdd�d�j�}�j	j
}|j�}|sj�j��|�}�j
j�}|j||�j|��j|��j|��}|s��j��t|j|@�s�d}n�tjdk�rVdd	lm}	m�m}
m}dd
lm}|	j|d��}
|
j�dk�rd}nFG�fd
d�d|�}|�}|
|�}|
j|�dk�sR|
j|�dk�rVd}|�s�y.ddlm}|�}|j�|j �|j!�Wn\t"k
�r�}z>t#|�}t$|�dk�r�|dd�d}dj%t&|�j'|�}WYdd}~XnX|t_(|t_tjS)N�resultr�rrcs.eZdZd�jjfd�jjfd�jjfgZdS)z*_is_gui_available.<locals>.USEROBJECTFLAGSZfInheritZ	fReserved�dwFlagsN)r`rarb�wintypesZBOOL�DWORD�_fields_rc)r�rcrd�USEROBJECTFLAGS�s

r�z,gui not available (WSF_VISIBLE flag not set)�darwin)�cdll�c_int�pointer�	Structure)�find_libraryZApplicationServicesz0gui tests cannot run without OS X window managercseZdZd�fd�fgZdS)z._is_gui_available.<locals>.ProcessSerialNumberZ
highLongOfPSNZlowLongOfPSNN)r`rarbr�rc)r�rcrd�ProcessSerialNumbersr�z#cannot run without OS X gui process)�Tk�2z [...]zTk unavailable due to {}: {}))�hasattr�_is_gui_availabler�rnrorpr�Zctypes.wintypesr�r�Zuser32ZGetProcessWindowStationZWinErrorr�r�ZGetUserObjectInformationWZbyrefZsizeof�boolr�r�r�r�Zctypes.utilr�ZLoadLibraryZCGMainDisplayIDZGetCurrentProcessZSetFrontProcessZtkinterr�Zwithdraw�updateZdestroy�	Exceptionrtr��format�typer`�reason)r�Z	UOI_FLAGSZWSF_VISIBLEr�Zdll�hZuofZneeded�resr�r�r�r�Zapp_servicesr�ZpsnZpsn_pr��root�eZ
err_stringrc)r�r�rdr��sh

r�cCstdkp|tkS)N)r)�resourcercrcrdr $scCs>t|�s |dkrd|}t|��|dkr:t�r:ttj��dS)Nz"Use of the %r resource not enabled�gui)r rr�r�)r�rwrcrcrdr!,scs��fdd�}|S)Ncs$tj�����fdd��}�|_|S)Nc
s�tj��krztj�jdd�d}yttt|jd���}Wntk
rLYn.X|�krzdjtt	���}t
jd�||f���||�S)N�-rrrxz(%s version %s or higher required, not %s)ro�system�releaser�rq�map�int�
ValueErrorr�rtrrrs)r��kw�version_txt�version�min_version_txt)r��min_version�sysnamercrd�wrapper=sz:_requires_unix_version.<locals>.decorator.<locals>.wrapper)�	functools�wrapsr�)r�r�)r�r�)r�rd�	decorator<sz)_requires_unix_version.<locals>.decoratorrc)r�r�r�rc)r�r�rd�_requires_unix_version5sr�cGs
td|�S)NZFreeBSD)r�)r�rcrcrdr"PscGs
td|�S)NZLinux)r�)r�rcrcrdr#Yscs�fdd�}|S)Ncs"tj����fdd��}�|_|S)Ncsxtjdkrntj�d}yttt|jd���}Wntk
rBYn,X|�krndjtt	���}t
jd||f���||�S)Nr�rrxz&Mac OS X %s or higher required, not %s)rnroZmac_verrqr�r�r�r�r�rtrrrs)r�r�r�r�r�)r�r�rcrdr�js
z4requires_mac_ver.<locals>.decorator.<locals>.wrapper)r�r�r�)r�r�)r�)r�rdr�isz#requires_mac_ver.<locals>.decoratorrc)r�r�rc)r�rdr$bscs��fdd�}|S)Ncstj�����fdd��}|S)NcsXy&�rtdk	rtj��n
tj��Wn&tk
rLtjd��d���YnX�||�S)Nz
hash digest 'z' is not available.)�_hashlib�new�hashlibr�rrrs)r��kwargs)�
digestnamer��opensslrcrdr��sz7requires_hashdigest.<locals>.decorator.<locals>.wrapper)r�r�)r�r�)r�r)r�rdr��sz&requires_hashdigest.<locals>.decoratorrc)r�rr�rc)r�rrdr%}s
z	127.0.0.1z::1cCs"tj||�}t|�}|j�~|S)N)�socketrH�close)�familyZsocktypeZtempsock�portrcrcrdrG�s
8cCs�|jtjkr�|jtjkr�ttd�r>|jtjtj�dkr>t	d��ttd�r~y |jtjtj
�dkrft	d��Wntk
r|YnXttd�r�|jtjtj
d�|j|df�|j�d}|S)N�SO_REUSEADDRrzHtests should never set the SO_REUSEADDR socket option on TCP/IP sockets!�SO_REUSEPORTzHtests should never set the SO_REUSEPORT socket option on TCP/IP sockets!�SO_EXCLUSIVEADDRUSEr)rr�AF_INETr��SOCK_STREAMr�Z
getsockoptZ
SOL_SOCKETrr
rr�Z
setsockoptr�bindZgetsockname)�sock�hostrrcrcrdrH�s


cCs:y|j|�Wn&tk
r4|j�tjd��YnXdS)Nzcannot bind AF_UNIX sockets)r
�PermissionErrorrrrrs)rZaddrrcrcrdrJs
cCsZtjrVd}z<y"tjtjtj�}|jtdf�dStk
rBYnXWd|rT|j�XdS)NrTF)rZhas_ipv6ZAF_INET6r	r
�HOSTv6r�r)rrcrcrd�_is_ipv6_enableds

rcstj���fdd��}|S)NcsNy�||�Wn:tk
rH}zdt|�kr6tjd���WYdd}~XnXdS)NZCERTIFICATE_VERIFY_FAILEDz.system does not contain necessary certificates)�IOErrorrtrrrs)r�r�r�)r�rcrd�decs
z&system_must_validate_cert.<locals>.dec)r�r�)r�rrc)r�rd�system_must_validate_certs	rr�i�ZdoubleZIEEEztest requires IEEE 754 doublesz
requires zlibz
requires gzipzrequires bz2z
requires lzma�java�ANDROID_API_LEVEL�win32z/system/bin/shz/bin/shz$testz@testz	{}_{}_tmp�æ�İ�Ł�φ�К�א�،�ت�ก� �€u-àòɘŁğr�ZNFD�ntr�u-共Ł♡ͣ�ztWARNING: The filename %r CAN be encoded by the filesystem encoding (%s). Unicode filename tests may not be effective��s-��surrogateescape��w����������r�ccs�d}|dkr&tj�}d}tjj|�}nBytj|�d}Wn.tk
rf|sN�tjd|t	dd�YnX|rttj
�}z
|VWd|r�|tj
�kr�t|�XdS)NFTz+tests may fail, unable to create temp dir: �)r�)�tempfile�mkdtempr�r��realpath�mkdirr�rfr�r��getpidr)r��quietZdir_created�pidrcrcrd�temp_dir�s&


r1ccsftj�}ytj|�Wn.tk
rD|s,�tjd|tdd�YnXztj�VWdtj|�XdS)Nz)tests may fail, unable to change CWD to: r))r�)r��getcwd�chdirr�rfr�r�)r�r/Z	saved_dirrcrcrd�
change_cwd	s

r4�tempcwdccs:t||d��$}t||d��}|VWdQRXWdQRXdS)N)r�r/)r/)r1r4)rur/Z	temp_pathZcwd_dirrcrcrdr$s�umaskccs&tj|�}z
dVWdtj|�XdS)N)r�r6)r6ZoldmaskrcrcrdrK8s

�datacCsbtjj|�r|S|dk	r&tjj||�}tgtj}x*|D]"}tjj||�}tjj|�r8|Sq8W|S)N)r�r��isabsr��
TEST_HOME_DIRrn�exists)r�Zsubdirr�Zdn�fnrcrcrdrIs
cCs(tj|tjtjBtjB�}tj|�dS)N)r��open�O_WRONLY�O_CREAT�O_TRUNCr)r��fdrcrcrdr[scCs,t|j��}dd�|D�}dj|�}d|S)NcSsg|]}d|�qS)z%r: %rrc)�.0Zpairrcrcrd�
<listcomp>cszsortdict.<locals>.<listcomp>z, z{%s})�sortedr�r�)�dictr�Z	reprpairsZ
withcommasrcrcrdr[`s
cCs*ttd�}z|j�S|j�tt�XdS)N�wb)r<r�filenorr)r�rcrcrd�make_bad_fdgs

rG)�lineno�offsetcCsp|jt��}t|dd�WdQRX|j}|j|j�|dk	rJ|j|j|�|j|j�|dk	rl|j|j|�dS)Nz
<test string>�exec)�assertRaises�SyntaxError�compileZ	exceptionZassertIsNotNonerH�assertEqualrI)�testcaseZ	statementrHrI�cmr�rcrcrdr&sscsVddl}ddl}�jdd��|jj|�djd�d}tjjt	|�}���fdd�}tjj
|�r|||�}|dk	rt|St|�td�t
r�td	|t�d
�|jj�}tr�|jjd�|j|d
d�}tr�|jjd�dkr�tj|d�}zBt|d��.}	|j�}
x|
�r|	j|
�|j�}
�q�WWdQRXWd|j�X||�}|dk	�rF|Std|��dS)Nr�checkr��/rcs>t|f����}�dkr|S�|�r2|jd�|S|j�dS)Nr)r<�seekr)r;r�)r�rQr�rcrd�check_valid_file�s
z*open_urlresource.<locals>.check_valid_fileZurlfetchz	fetching %s ...)r��Accept-Encoding�gzip�)r�zContent-Encoding)ZfileobjrEzinvalid resource %r���)rUrV)Zurllib.requestZurllib.parse�pop�parseZurlparser�r�r�r��
TEST_DATA_DIRr:rr!rr�rZrequestZbuild_openerrVZ
addheadersr�r<Zheaders�getZGzipFile�read�writerr
)Zurlr�r��urllibr�r;rTr��opener�out�src)r�rQr�rdrI~s<	



c@s0eZdZdd�Zdd�Zedd��Zdd�Zd	S)
�WarningsRecordercCs||_d|_dS)Nr)�	_warnings�_last)�selfZ
warnings_listrcrcrd�__init__�szWarningsRecorder.__init__cCsDt|j�|jkr t|jd|�S|tjjkr0dStd||f��dS)Nrz%r has no attribute %rrX)r�rdrer�rf�WarningMessage�_WARNING_DETAILSr�)rf�attrrcrcrd�__getattr__�s
zWarningsRecorder.__getattr__cCs|j|jd�S)N)rdre)rfrcrcrdrf�szWarningsRecorder.warningscCst|j�|_dS)N)r�rdre)rfrcrcrd�reset�szWarningsRecorder.resetN)r`rarbrgrk�propertyrfrlrcrcrcrdrc�srcc
cs
tjd�}|jjd�}|r"|j�tjdd�� }tjdjd�t	|�VWdQRXt
|�}g}xz|D]r\}}d}	xH|dd�D]8}|j}
tj
|t|
�tj�r�t|
j|�r�d}	|j|�q�W|	rf|rf|j||jf�qfW|r�td|d	��|�rtd
|d	��dS)Nr�Z__warningregistry__T)�recordrf�alwaysFzunhandled warning %srz)filter (%r, %s) did not catch any warning)rn�	_getframe�	f_globalsr\�clearrfrgry�simplefilterrcr{�message�re�matchrt�I�
issubclassr��remover�r`�AssertionError)�filtersr/�frame�registry�wZreraiseZmissingrw�cat�seenZwarningrcrcrd�_filterwarnings�s0
r�cOs.|jd�}|s$dtff}|dkr$d}t||�S)Nr/r�T)r\�Warningr�)r{r�r/rcrcrdrR�s

r�ccsHtjdd��&}tjd||d�dV|r.t�WdQRX|j|g�dS)NT)rnro)rt�category)rfrgrh�
gc_collectrN)rOrtr�Zforce_gc�warnsrcrcrd�check_no_warningssr�ccsBtjdd�� }tjdtd�dVt�WdQRX|j|g�dS)NT)rnro)r�)rfrgrh�ResourceWarningr�rN)rOr�rcrcrdrSs
c@s$eZdZdd�Zdd�Zdd�ZdS)rcGsNtjj�|_x<|D]4}|tjkrtj|}|j|kr>tj|j=tj|=qWdS)N)rnry�copy�original_modulesr`)rfZmodule_namesZmodule_namer�rcrcrdrg?s




zCleanImport.__init__cCs|S)Nrc)rfrcrcrd�	__enter__LszCleanImport.__enter__cGstjj|j�dS)N)rnryr�r�)rf�
ignore_excrcrcrd�__exit__OszCleanImport.__exit__N)r`rarbrgr�r�rcrcrcrdr3s
c@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)rTcCstj|_i|_dS)N)r��environ�_environ�_changed)rfrcrcrdrgXszEnvironmentVarGuard.__init__cCs
|j|S)N)r�)rf�envvarrcrcrd�__getitem__\szEnvironmentVarGuard.__getitem__cCs*||jkr|jj|�|j|<||j|<dS)N)r�r�r\)rfr��valuercrcrd�__setitem___s
zEnvironmentVarGuard.__setitem__cCs2||jkr|jj|�|j|<||jkr.|j|=dS)N)r�r�r\)rfr�rcrcrd�__delitem__es

zEnvironmentVarGuard.__delitem__cCs
|jj�S)N)r��keys)rfrcrcrdr�lszEnvironmentVarGuard.keyscCs
t|j�S)N)�iterr�)rfrcrcrd�__iter__oszEnvironmentVarGuard.__iter__cCs
t|j�S)N)r�r�)rfrcrcrd�__len__rszEnvironmentVarGuard.__len__cCs|||<dS)Nrc)rfr�r�rcrcrd�setuszEnvironmentVarGuard.setcCs
||=dS)Nrc)rfr�rcrcrd�unsetxszEnvironmentVarGuard.unsetcCs|S)Nrc)rfrcrcrdr�{szEnvironmentVarGuard.__enter__cGsJx<|jj�D].\}}|dkr0||jkr:|j|=q||j|<qW|jt_dS)N)r�r�r�r�r�)rfr��k�vrcrcrdr�~s

zEnvironmentVarGuard.__exit__N)r`rarbrgr�r�r�r�r�r�r�r�r�r�rcrcrcrdrTSsc@s$eZdZdd�Zdd�Zdd�ZdS)�
DirsOnSysPathcGs(tjdd�|_tj|_tjj|�dS)N)rnr��original_value�original_object�extend)rf�pathsrcrcrdrg�szDirsOnSysPath.__init__cCs|S)Nrc)rfrcrcrdr��szDirsOnSysPath.__enter__cGs|jt_|jtjdd�<dS)N)r�rnr�r�)rfr�rcrcrdr��szDirsOnSysPath.__exit__N)r`rarbrgr�r�rcrcrcrdr��sr�c@s&eZdZdd�Zdd�Zddd�ZdS)	r'cKs||_||_dS)N)r��attrs)rfr�r�rcrcrdrg�szTransientResource.__init__cCs|S)Nrc)rfrcrcrdr��szTransientResource.__enter__NcCsT|dk	rPt|j|�rPx:|jj�D]$\}}t||�s4Pt||�|kr Pq Wtd��dS)Nz%an optional resource is not available)rxr�r�r�r�r�r)rfZtype_r��	tracebackrjZ
attr_valuercrcrdr��s
zTransientResource.__exit__)NNN)r`rarbrgr�r�rcrcrcrdr'�s)�errnog>@)r��errnosc	#spd d!d"d#d$d%g}d'd)d+d-d.g}td|��|�g��sRdd�|D��dd�|D�����fdd�}tj�}z�y|dk	r�tj|�dVWn�tjk
�r�}z&tr�tjj	�j
dd��|�WYdd}~Xn�tk
�rZ}zpx^|j
}t|�dk�rt
|dt��r|d}n*t|�dk�r8t
|dt��r8|d}nP�q�W||��WYdd}~XnXWdtj|�XdS)/N�ECONNREFUSED�o�
ECONNRESET�h�EHOSTUNREACH�q�ENETUNREACH�e�	ETIMEDOUT�n�
EADDRNOTAVAIL�c�	EAI_AGAINr)�EAI_FAILr��
EAI_NONAMEr��
EAI_NODATA��
WSANO_DATA�*zResource %r is not availablecSsg|]\}}tt||��qSrc)r�r�)rAru�numrcrcrdrB�sz&transient_internet.<locals>.<listcomp>cSsg|]\}}tt||��qSrc)r�r)rArur�rcrcrdrB�scs�t|dd�}t|tj�s�t|tj�r,|�ks�t|tjj�rTd|jkoNdkns�t|tjj	�r�d|j
ks�d|j
ks�d|j
ks�|�kr�ts�tj
j�jdd��|�dS)	Nr�i�iW�ConnectionRefusedError�TimeoutError�EOFErrorr�
)r��
isinstancerr�Zgaierrorr_�errorZ	HTTPError�codeZURLErrorr�rrn�stderrr^r�)r��n)�captured_errnos�denied�
gai_errnosrcrd�filter_error�s


z(transient_internet.<locals>.filter_errorrr�r)r�r�)r�r�)r�r�)r�r�)r�r�)r�r����)r�r����)r�r����)r�r����)r�r�)r�r�)rrZgetdefaulttimeoutZsetdefaulttimeout�nntplibZNNTPTemporaryErrorrrnr�r^r�r�r�r�)	Z
resource_namer�r�Zdefault_errnosZdefault_gai_errnosr�Zold_timeoutr��arc)r�r�r�rdr+�sP



c
csFddl}tt|�}tt||j��ztt|�VWdtt||�XdS)Nr)�ior�rn�setattr�StringIO)Zstream_namer�Zorig_stdoutrcrcrd�captured_outputs
r�cCstd�S)Nr�)r�rcrcrcrdrscCstd�S)Nr�)r�rcrcrcrdr%scCstd�S)N�stdin)r�rcrcrcrdr.s
cCs*tj�trtjd�tj�tj�dS)Ng�������?)�gcZcollectr@r�r�rcrcrcrdr�;s


r�c
cs.tj�}tj�z
dVWd|r(tj�XdS)N)r��	isenabled�disable�enable)Zhave_gcrcrcrd�
disable_gcKs
r�cCs:tjd�pd}d}x|j�D]}|jd�r|}qW|dkS)N�	PY_CFLAGSr�z-O�-O0�-Og)r�r�r�)�	sysconfig�get_config_varr�rp)ZcflagsZ	final_optr�rcrcrd�python_is_optimizedVs
r�ZnPZ0n�gettotalrefcountZ2PZ0Pr�cCstjt|t�S)N)�struct�calcsize�_header�_align)�fmtrcrcrd�calcobjsizegsr�cCstjt|t�S)N)r�r��_vheaderr�)r�rcrcrd�calcvobjsizejsr���	cCspddl}tj|�}t|�tkr(|jt@sBt|�tkrLt|�jt@rL||j7}dt|�||f}|j|||�dS)Nrz&wrong size for %s: got %d, expected %d)	�	_testcapirn�	getsizeofr��	__flags__�_TPFLAGS_HEAPTYPE�_TPFLAGS_HAVE_GCZSIZEOF_PYGC_HEADrN)�test�o�sizer�r�rwrcrcrd�check_sizeofqs

r�cs��fdd�}|S)Ncs$���fdd�}�j|_�j|_|S)Ncs�y ddl}t|��}|j|�}Wn(tk
r6�YnBd}}Yn0Xx,�D]$}y|j||�PWqPYqPXqPWz
�||�S|r�|r�|j||�XdS)Nr)�localer��	setlocaler�)r��kwdsr�r�Zorig_locale�loc)�catstrr��localesrcrd�inner�s$



z1run_with_locale.<locals>.decorator.<locals>.inner)r`�__doc__)r�r�)r�r�)r�rdr��sz"run_with_locale.<locals>.decoratorrc)r�r�r�rc)r�r�rdrU�scs�fdd�}|S)Ncs"��fdd�}�j|_�j|_|S)Ncs�y
tj}Wntk
r(tjd��YnXdtjkr@tjd}nd}�tjd<|�z
�||�S|dkrrtjd=n
|tjd<tj�XdS)Nztzset requiredZTZ)r��tzsetr�rrrsr�r�)r�r�r�Zorig_tz)r��tzrcrdr��s





z-run_with_tz.<locals>.decorator.<locals>.inner)r`r�)r�r�)r�)r�rdr��szrun_with_tz.<locals>.decoratorrc)r�r�rc)r�rdr\�scCs�dttdtd�}tjd|tjtjB�}|dkr>td|f��tt|j	d��||j	d�j
��}|a|tkrrt}|t
dkr�td|f��|adS)Ni)r��m�g�tz(\d+(\.\d+)?) (K|M|G|T)b?$zInvalid memory limit %rrr)z$Memory limit %r too low to be useful)�_1M�_1Grurv�
IGNORECASE�VERBOSEr�r��float�group�lower�real_max_memuse�MAX_Py_ssize_t�_2Gr)�limitZsizesr�ZmemlimitrcrcrdrY�s$c@s$eZdZdd�Zdd�Zdd�ZdS)�_MemoryWatchdogcCsdjtj�d�|_d|_dS)Nz/proc/{pid}/statm)r0F)r�r�r.�procfile�started)rfrcrcrdrg�sz_MemoryWatchdog.__init__cCs�yt|jd�}Wn<tk
rL}z tjdj|�t�tjj	�dSd}~XnXt
d�}tjtj
|g|tjd�|_|j�d|_dS)N�rz!/proc not available for stats: {}zmemory_watchdog.py)r�r�T)r<r
r�rfr�r�r�rnr��flushr�
subprocess�Popen�
executableZDEVNULL�mem_watchdogrr)rfr�r�Zwatchdog_scriptrcrcrd�start�s
z_MemoryWatchdog.startcCs|jr|jj�|jj�dS)N)rrZ	terminate�wait)rfrcrcrd�stop�s
z_MemoryWatchdog.stopN)r`rarbrgrrrcrcrcrdr	�sr	cs���fdd�}|S)Ncs ���fdd����_��_�S)Nc
s��j}�j}tsd}n|}ts$�rFt||krFtjd||d��tr|tr|t�tdj||dd��t�}|j	�nd}z
�||�S|r�|j
�XdS)	Niz'not enough memory: %.1fG minimum neededir)z* ... expected peak memory use: {peak:.1f}G)Zpeaki@i@)r��memuserrrrsrr�r�r	rr)rfr�r�maxsizeZwatchdog)�dry_runr�r�rcrdr�s*


z.bigmemtest.<locals>.decorator.<locals>.wrapper)r�r)r�)rrr�)r�r�rdr�szbigmemtest.<locals>.decoratorrc)r�rrr�rc)rrr�rdr3s
!cs�fdd�}|S)NcsDttkr8td
kr$tdkr$tjd��q@tjdtd��n�|�SdS)
Nr��?r�z-not enough memory: try a 32-bit build insteadz'not enough memory: %.1fG minimum neededir)ll����li@)rrrrrs)rf)r�rcrdr�3sz!bigaddrspacetest.<locals>.wrapperrc)r�r�rc)r�rdr41sc@seZdZdd�ZdS)r,cCstj�}||�|S)N)rrZ
TestResult)rfr�r�rcrcrd�runDszBasicTestRunner.runN)r`rarbrrcrcrcrdr,CscCs|S)Nrc)r�rcrcrd�_idIsrcCs<|dkrt�rtjtj�St|�r(tStjdj|��SdS)Nr�zresource {0!r} is not enabled)r�rr�skipr�r rr�)r�rcrcrd�requires_resourceLs
rcCs&trt|krtjd|tf�StSdS)Nz%s at Android API level %d)rA�_ANDROID_API_LEVELrrrr)�levelr�rcrcrdr>TscCstdd�|�S)NT)�cpython)�impl_detail)r�rcrcrdr5[scKsVtf|�rtS|dkrLt|�\}}|r,d}nd}t|j��}|jdj|��}tj|�S)Nz*implementation detail not available on {0}z%implementation detail specific to {0}z or )	rBr�
_parse_guardsrCr�r�r�rrr)rw�guardsZ
guardnames�defaultrcrcrdr!as
r!cCsTtdkr:ddl}y|j�daWntk
r8daYnXd}trF|Stj|�|�S)NrTFz6requires a functioning shared semaphore implementation)�_have_mp_queue�multiprocessingZQueuermrrr)r�r&rwrcrcrdr?os
cCs*|sddidfSt|j��d}||fS)Nr TFr)r{�values)r#Zis_truercrcrdr"~sr"cKs t|�\}}|jtj�j�|�S)N)r"r\roZpython_implementationr)r#r$rcrcrdrB�scs,ttd�s�Stj���fdd��}|SdS)N�gettracecs.tj�}ztjd��||�Stj|�XdS)N)rnr(�settrace)r�r�Zoriginal_trace)r�rcrdr��s


zno_tracing.<locals>.wrapper)r�rnr�r�)r�r�rc)r�rd�
no_tracing�s
r*cCstt|��S)N)r*r5)r�rcrcrd�
refcount_test�sr+cCsRg}xB|jD]8}t|tj�r2t||�|j|�q||�r|j|�qW||_dS)N)Z_testsr�rr�	TestSuite�
_filter_suiter�)�suiteZpredZnewtestsr�rcrcrdr-�s
r-cCs�ttjttdk	d�}|j|�}tdk	r4tj|j��|js>t	�|j
�s�t|j�dkrl|j
rl|jdd}n6t|j
�dkr�|jr�|j
dd}nd}ts�|d7}t|��dS)N)�	verbosityZcapture_outputrrzmultiple errors occurredz!; run in verbose mode for details)rrnr�r�junit_xml_listrr�Zget_xml_elementZtestsRunrZ
wasSuccessfulr��errorsZfailuresr
)r.Zrunnerr�r�rcrcrd�
_run_suite�s"
r2cCstdkrdSt|j��SdS)NT)�_match_test_func�id)r�rcrcrd�
match_test�sr5cCsd|kotjd|�S)Nrxz[?*\[\]])ru�search)r�rcrcrd�_is_full_match_test�sr7csr|tkrdS|sd}f}nHttt|��r4t|�j}n.djttj|��}t	j
|�j��fdd�}|}t|�a|a
dS)N�|cs$�|�rdStt�|jd���SdS)NTrx)�anyr�r�)Ztest_id)�regex_matchrcrd�match_test_regex�sz)set_match_tests.<locals>.match_test_regex)�_match_test_patterns�allr�r7r��__contains__r��fnmatch�	translaterurMrvrqr3)Zpatternsr�Zregexr;rc)r:rd�set_match_tests�srAcGs�tjtjf}tj�}xh|D]`}t|t�rT|tjkrJ|jtjtj|��qzt	d��qt||�rj|j|�q|jtj
|��qWt|t�t
|�dS)Nz)str arguments must be keys in sys.modules)rrr,ZTestCaser�rtrnryZaddTestZ
findTestCasesr�Z	makeSuiter-r5r2)�classesZvalid_typesr.�clsrcrcrdr-s





cCsdS)Nrcrcrcrcrd�_check_docstrings(srD�WITH_DOC_STRINGSztest requires docstringscCs`ddl}|dkrt}nd}|j|||d�\}}|rBtd||f��trXtd|j|f�||fS)Nr)r�optionflagsz%d of %d doctests failedz,doctest (%s) ... %d tests with zero failures)�doctestrZtestmodr
r�r`)r�r/rFrGr�r�rcrcrdr.9scCstjj�fS)N)rnryr�rcrcrcrd�
modules_setupTsrHcCs:dd�tjj�D�}tjj�tjj|�tjj|�dS)NcSs"g|]\}}|jd�r||f�qS)z
encodings.)rp)rAr�r�rcrcrdrB[sz#modules_cleanup.<locals>.<listcomp>)rnryr�rrr�)Z
oldmodulesZ	encodingsrcrcrd�modules_cleanupWs
rIcCs"trtj�tjj�fSdffSdS)Nr)�_thread�_count�	threading�	_danglingr�rcrcrcrdrNzscGsJtsdSd}x8t|�D],}tj�tjf}||kr2Ptjd�t�qWdS)N�dg{�G�z�?)rJ�rangerKrLrMr�r�r�)Zoriginal_valuesZ
_MAX_COUNT�countr'rcrcrdrO�s
cs"ts�Stj���fdd��}|S)Ncst�}z�|�St|�XdS)N)rNrO)r��key)r�rcrdr��szreap_threads.<locals>.decorator)rJr�r�)r�r�rc)r�rdrP�s�N@ccs�tj�}z
dVWdtj�}||}xjtj�}||kr8Ptj�|kr|tj�|}d||�d|d�d|�d|�d�	}t|��tjd�t�q&WXdS)Nz!wait_threads() failed to cleanup z threads after z.1fz seconds (count: z
, old count: �)g{�G�z�?)rJrKr�Z	monotonicrzr�r�)r�Z	old_countZ
start_timeZdeadlinerPZdtrwrcrcrd�wait_threads_exit�s
$
rTc
CsZttd�rVd}xFy2tj|tj�\}}|dkr.Ptd|tjd�WqPYqXqWdS)N�waitpidrrz2Warning -- reap_children() reaped child process %s)r�rX)r�r�rU�WNOHANGr�rnr�)Zany_processr0ZstatusrcrcrdrL�s
ccs*t|�}g}zZy$x|D]}|j�|j|�qWWn*trVtdt|�t|�f��YnXdVWdz�|rt|�tj�}}xltdd�D]^}|d7}x$|D]}|jt	|tj�d��q�Wdd�|D�}|s�Ptr�tdt|�|f�q�WWdd	d�|D�}|�r"t
jtj
�td
t|���XXdS)Nz/Can't start %d threads, only %d threads startedrr�<g{�G�z�?cSsg|]}|j�r|�qSrc)�isAlive)rAr�rcrcrdrB�sz!start_threads.<locals>.<listcomp>z7Unable to join %d threads during a period of %d minutescSsg|]}|j�r|�qSrc)rX)rAr�rcrcrdrB�szUnable to join %d threads)r{rr�rr�r�r�rOr��max�faulthandlerZdump_tracebackrnr�rz)ZthreadsZunlockrr�ZendtimeZ	starttimer�rcrcrdrQ�s>


c
csnt||�r<t||�}t|||�z
|VWdt|||�Xn.t|||�z
dVWdt||�rht||�XdS)N)r�r�r��delattr)r�rj�new_val�real_valrcrcrdrW�s




ccsX||kr0||}|||<z
|VWd|||<Xn$|||<z
dVWd||krR||=XdS)Nrc)r��itemr\r]rcrcrdrV	s

cCstjdd|�j�}|S)Ns\[\d+ refs, \d+ blocks\]\r?\n?�)ru�sub�strip)r�rcrcrd�strip_python_stderr8	srbZ	getcountsz-types are immortal if COUNT_ALLOCS is definedcCstj�S)N)rZ_args_from_interpreter_flagsrcrcrcrd�args_from_interpreter_flagsE	srccCstj�S)N)rZ"_optim_args_from_interpreter_flagsrcrcrcrd�!optim_args_from_interpreter_flagsJ	srdc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rMcCstjjj|d�||_dS)Nr)�logging�handlers�BufferingHandlerrg�matcher)rfrhrcrcrdrgT	szTestHandler.__init__cCsdS)NFrc)rfrcrcrd�shouldFlush]	szTestHandler.shouldFlushcCs|j|�|jj|j�dS)N)r�r�r��__dict__)rfrnrcrcrd�emit`	s
zTestHandler.emitcKs.d}x$|jD]}|jj|f|�rd}PqW|S)NFT)r�rh�matches)rfr�r��drcrcrdrld	szTestHandler.matchesN)r`rarbrgrirkrlrcrcrcrdrMS	s	c@s eZdZdZdd�Zdd�ZdS)	rXrwrtcKs<d}x2|D]*}||}|j|�}|j|||�s
d}Pq
W|S)NTF)r\�match_value)rfrmr�r�r�r��dvrcrcrdrls	s

zMatcher.matchescCsHt|�t|�krd}n.t|�tk	s,||jkr6||k}n|j|�dk}|S)NFr)r�rt�_partial_matches�find)rfr�ror�r�rcrcrdrn�	s
zMatcher.match_valueN)rwrt)r`rarbrprlrnrcrcrcrdrXo	sc
CsZtdk	rtStd}ytjt|�d}Wntttfk
rFd}YnXtj|�|a|S)NrTF)�_can_symlinkrr��symlinkr��NotImplementedErrorr�ry)Zsymlink_path�canrcrcrdr�	s

cCs t�}d}|r|Stj|�|�S)Nz*Requires functional symlink implementation)rrrr)r��okrwrcrcrdr/�	scCs�tdk	rtSttd�sd}n�tj�}tj|d�\}}z�ttd���}y`tj|dd�tj|dd�tj|j	�dd�t
j�}tj
d	|�}|dkp�t|jd
��dk}Wntk
r�d}YnXWdQRXWdtt�t|�t|�X|a|S)N�setxattrF)�dirrEs	user.testr_strusted.foos42z
2.6.(\d{1,2})r�')�
_can_xattrr�r�r*r+Zmkstempr<rrwrFror�rurvr�rr�rr�)ruZtmp_dirZtmp_fpZtmp_name�fpZkernel_versionr�rcrcrd�	can_xattr�	s,

r|cCs t�}d}|r|Stj|�|�S)Nz(no non-broken extended attribute support)r|rrr)r�rvrwrcrcrdr8�	scCs$tpt}d}|r|Stj|�|�S)Nz#Not run for (non-extended) PGO task)r]�PGO_EXTENDEDrrr)r�rvrwrcrcrd�skip_if_pgo_task�	s
r~cCs^tj|d��H}|j}|j�}||kr,|j�}ytjj||�Stk
rNdSXWdQRXdS)N)rxF)	r*ZNamedTemporaryFileru�upperrr�r��samefiler�)Z	directory�base�	base_pathZ	case_pathrcrcrdr�	s)recCs>tt|��tt|��}|r(|t|�8}tdd�|D��}|S)Ncss(|] }|jd�s|jd�r|VqdS)�_�__N)rp�endswith)rAr�rcrcrd�	<genexpr>�	sz&detect_api_mismatch.<locals>.<genexpr>)r�rx)Zref_apiZ	other_apireZ
missing_itemsrcrcrdr<�	s
cCs�|dkr|jf}nt|t�r"|f}t|�}xbt|�D]V}|jd�s4||krLq4t||�}t|dd�|ks�t|d�r4t|tj	�r4|j
|�q4W|j|j|�dS)Nr�ra)
r`r�rtr�rxrpr�r��types�
ModuleType�addZassertCountEqual�__all__)Z	test_caser�Zname_of_moduleZextraZ	blacklistZexpectedrur�rcrcrdr=�	s)


c@s$eZdZdZdZdd�Zdd�ZdS)rZNc
Csrtjjd�r�ddl}|jj|_d}|jj|�|_|jj|j|B�yddl	}|j
Wnttfk
rlYnLXi|_
x�|j|j|jgD].}|j
||j�}|j||j�}||f|j
|<q�Wn�tdk	�r
y*tjtj�|_tjtjd|jdf�Wnttfk
�rYnXtjdk�rndddd	g}tj|tjtjd
�}|�|j�d}	WdQRX|	j�dk�rntdd
dd�|S)Nr�rr�rr�z/usr/bin/defaultsr]zcom.apple.CrashReporterZ
DialogType)r�r�s	developerz:this test triggers the Crash Reporter, that is intentionalr�T)�endr
) rnrorpr�r�r��_k32�SetErrorMode�	old_value�msvcrt�CrtSetReportModer�rm�	old_modes�CRT_WARN�	CRT_ERROR�
CRT_ASSERTZCRTDBG_MODE_FILE�CrtSetReportFileZCRTDBG_FILE_STDERRr�Z	getrlimit�RLIMIT_CORE�	setrlimitr�r�rr�PIPEZcommunicaterar�)
rfr�ZSEM_NOGPFAULTERRORBOXr��report_type�old_mode�old_file�cmd�procr�rcrcrdr�2
sN




zSuppressCrashReport.__enter__cGs�|jdkrdStjjd�rl|jj|j�|jr�ddl}xj|jj�D]$\}\}}|j	||�|j
||�qBWn6tdk	r�ytjtj
|j�Wnttfk
r�YnXdS)Nr�r)r�rnrorpr�r�r�r�r�r�r�r�r�r�r�r�)rfr�r�r�r�r�rcrcrdr�s
s
zSuppressCrashReport.__exit__)r`rarbr�r�r�r�rcrcrcrdrZ)
sAcsrt���d�y�j��Wn$ttfk
r@t��d��YnXd�����fdd�}|j|�t��|�dS)NFTcs �rt����n
t���dS)N)r�r[rc)�
attr_is_local�	attr_name�object_to_patchr�rcrd�cleanup�
szpatch.<locals>.cleanup)r�rjr�rZ
addCleanupr�)Z
test_instancer�r�Z	new_valuer�rc)r�r�r�r�rd�patch�
s


r�cCsFyddl}Wntk
r YnX|j�r4tjd��ddl}|j|�S)NrzUrun_in_subinterp() cannot be used if tracemalloc module is tracing memory allocations)�tracemallocrmZ
is_tracingrrrsr��run_in_subinterp)r�r�r�rcrcrdr��
s
r�csHG��fdd�d|�}d�|||���|jtt��t�|j��dS)NcseZdZ��fdd�ZdS)z%check_free_after_iterating.<locals>.Acs*d�yt��Wntk
r$YnXdS)NT)�next�
StopIteration)rf)�done�itrcrd�__del__�
s
z-check_free_after_iterating.<locals>.A.__del__N)r`rarbr�rc)r�r�rcrd�A�
sr�F)rKr�r�r�Z
assertTrue)r�r�rCr�r�rc)r�r�rd�check_free_after_iterating�
s	r�cCs|ddlm}m}m}|j�}|j|�xP|jD]F}|r@||kr@q.t||�}|rPn
|dkrZq.|j|d�dkr.|dSq.WdS)Nr)�	ccompilerr��spawn)	Z	distutilsr�r�r�Znew_compilerZcustomize_compilerZexecutablesr�Zfind_executable)Z	cmd_namesr�r�r�Zcompilerrur�rcrcrdr^�
s	

cCs@d}tr6||kr6tdkr.tjddg�j�dkatr6|}tj|�S)Ng�h㈵��>Zgetpropzro.kernel.qemu�1)rA�_is_android_emulatorrZcheck_outputrarnrD)ZintervalZminimum_intervalrcrcrdrD�
sc
cs>tjj�}tj�}ztj�dVWd|r8tj|dd�XdS)NT)r�Zall_threads)rnr�rFrZ�
is_enabledr�r�)r@r�rcrcrd�disable_faulthandler�
s

r�c	/Cs�tjjd
�r8ytjd�}t|�dStk
r6YnXd}ttd�rjytjd�}Wnt	k
rhYnXd}tjdkr�yd	dl
}|jWntt
fk
r�Yn0Xi}x(|j|j|jfD]}|j|d	�||<q�Wzpd	}xft|�D]Z}ytj|�}Wn4t	k
�r(}z|jtjk�r�WYdd}~Xq�Xtj|�|d7}q�WWd|dk	�rzx*|j|j|jfD]}|j|||��q`WX|S)N�linux�freebsdz
/proc/self/fdr��sysconf�SC_OPEN_MAXrr)r�r�)rnrorpr�r�r�r�r�r�r�r�r�r�rmr�r�r�rO�dupr�ZEBADFr)	�namesZMAXFDr�r�r�rPr@Zfd2r�rcrcrdr_	sP





c@s$eZdZdd�Zdd�Zdd�ZdS)�SaveSignalscCsjddl}||_ttd|j��|_x>dD]6}yt||�}Wntk
rNw&YnX|jj|�q&Wi|_dS)Nrr�SIGKILL�SIGSTOP)r�r�)	�signalr{rO�NSIG�signalsr�r�ryrf)rfr�Zsigname�signumrcrcrdrgMs
zSaveSignals.__init__cCs4x.|jD]$}|jj|�}|dkr"q||j|<qWdS)N)r�r��	getsignalrf)rfr��handlerrcrcrd�saveZs
zSaveSignals.savecCs*x$|jj�D]\}}|jj||�qWdS)N)rfr�r�)rfr�r�rcrcrd�restorefszSaveSignals.restoreN)r`rarbrgr�r�rcrcrcrdr�Ds	
r�c@s$eZdZdd�Zdd�Zdd�ZdS)�FakePathcCs
||_dS)N)r�)rfr�rcrcrdrgnszFakePath.__init__cCsd|j�d�S)Nz
<FakePath �>)r�)rfrcrcrd�__repr__qszFakePath.__repr__cCs6t|jt�s$t|jt�r,t|jt�r,|j�n|jSdS)N)r�r��
BaseExceptionr�rx)rfrcrcrd�
__fspath__ts
zFakePath.__fspath__N)r`rarbrgr�r�rcrcrcrdr�ksr�ccs.tj�}ztj|�dVWdtj|�XdS)N)rn�get_int_max_str_digits�set_int_max_str_digits)Z
max_digitsZcurrentrcrcrd�adjust_int_max_str_digits|s


r�)T)F)F)N)Nii@i@i@ii)rrrrrrrrrr r!)r%r#r&r'r()NF)F)r5F)N)Fi@ii)T)N)Nr)rR)N(r`rm�collections.abc�collections�
contextlibZdatetimer�rZr?r�r�r�rl�importlib.utilr�Zlogging.handlersrer�r�rorur�rr�r�rrnr�r*r�r�rrZurllib.errorr_rfZ
testresultrrJrLZmultiprocessing.processr&�zlibrV�bz2Zlzmar�r�r�r�r	r
rrsr�contextmanagerrjr
r~r�r:r;rr6rrrrr0rr�rrrr�rpr�r�r�r�r�rr�rr�rr�r r!r�r"r#r$r%rErrr	rGrHrJrrFrrZ
SOCK_MAX_SIZEZ
skipUnlessr�
__getformat__r7r9r0r1r2r@r�rrArCrurr�r.ZFS_NONASCII�	character�fsdecode�fsencode�UnicodeErrorZTESTFN_UNICODEZunicodedata�	normalize�getfilesystemencodingZTESTFN_ENCODINGZTESTFN_UNENCODABLEZgetwindowsversion�encode�UnicodeEncodeErrorr��decode�UnicodeDecodeErrorZTESTFN_UNDECODABLEZTESTFN_NONASCIIr2rr]r}r1r4rr�rKr�r�r�r�ZTEST_SUPPORT_DIRr9r�r[rrr[rGr&rI�objectrcr�rRr�r�rSr�abc�MutableMappingrTr�r'r�r�r(r�r)r*r+r�rrrr�r�r�r�r�r�r�r�r�r�r�rUr\r�r�rZ_4GrrrYr	r3r4r,rrr>r5r!r%r?r"rBr*r+r-r2r3r<r5r7rAr-rDZMISSING_C_DOCSTRINGSr�ZHAVE_DOCSTRINGSZrequires_docstringsr.rHrIZenvironment_alteredrNrOrPrTrLrQrWrVrbZskipIfZrequires_type_collectingrcrdrfrgrMrXrrrr/rzr|r8r~rr<r=rZr�r�r�r^r�rDr�r_r�r�r�rcrcrcrd�<module>s�











2	
!

J			>%	


%2' 5M		


$
#
0







(




"
#
	"
:_";'support/__pycache__/script_helper.cpython-36.opt-2.pyc000064400000012366150327172730016740 0ustar003

�\dh�)�@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZmZdadd�ZGdd�dejdd#��Zdd�Zd
d�Zdd�Zdd�Zejejd�dd�Zdd�Zd$dd�Zd%dd�Zd&dd�Zd'd!d"�ZdS)(�N)�source_from_cache)�make_legacy_pyc�strip_python_stderrcCsVtdkrRdtjkrdadSytjtjdddg�Wntjk
rLdaYnXdatS)NZ
PYTHONHOMETz-Ez-czimport sys; sys.exit(0)F)�$__cached_interp_requires_environment�os�environ�
subprocessZ
check_call�sys�
executableZCalledProcessError�rr�2/usr/lib64/python3.6/test/support/script_helper.py� interpreter_requires_environments


r
c@seZdZdd�ZdS)�_PythonRunResultcCs�d}|j|j}}t|�|kr0d||d�}t|�|krNd||d�}|jdd�j�}|jdd�j�}td|j|||f��dS)	N�P�ds(... truncated stdout ...)s(... truncated stderr ...)�ascii�replacezRProcess return code is %d
command line: %r

stdout:
---
%s
---

stderr:
---
%s
---i@)�out�err�len�decode�rstrip�AssertionError�rc)�self�cmd_line�maxlenrrrrr�fail>sz_PythonRunResult.failN)�__name__�
__module__�__qualname__rrrrrr;srrrrc
Ost�}d|kr|jd�}n|o$|}tjddg}|rB|jd�n|rX|rX|jd�|jdd�r�i}tjdkr�tjd|d<n
tjj�}d	|kr�d
|d	<|j	|�|j
|�tj|tj
tj
tj
|d�}|�*z|j�\}}Wd|j�tj�XWdQRX|j}	t|�}t|	||�|fS)NZ
__isolatedz-XZfaulthandlerz-Iz-EZ
__cleanenvZwin32Z
SYSTEMROOT�TERM�)�stdin�stdout�stderr�env)r
�popr	r
�append�platformrr�copy�update�extendr�Popen�PIPEZcommunicate�kill�_cleanup�
returncoderr)
�args�env_varsZenv_required�isolatedrr&�procrrrrrr�run_python_until_end[s:





r6cOs4t||�\}}|jr|s&|jr0|r0|j|�|S)N)r6rr)Zexpected_successr2r3�resrrrr�_assert_python�s
r8cOstd|�|�S)NT)T)r8)r2r3rrr�assert_python_ok�sr9cOstd|�|�S)NF)F)r8)r2r3rrr�assert_python_failure�sr:)r$r%cOsXtjg}t�s|jd�|j|�|jdttj��}d|d<t	j
|ft	j||d�|��S)Nz-Er&Zvt100r!)r#r$r%)r	r
r
r(r,�
setdefault�dictrrrr-r.)r$r%r2�kwrr&rrr�spawn_python�s

r>cCs2|jj�|jj�}|jj�|j�tj�|S)N)r#�closer$�read�waitrr0)�p�datarrr�kill_python�s


rDFcCsP|}|s|tjd7}tjj||�}t|ddd�}|j|�|j�tj�|S)N�py�wzutf-8)�encoding)	r�extsep�path�join�open�writer?�	importlib�invalidate_caches)Z
script_dir�script_basename�sourceZomit_suffixZscript_filename�script_nameZscript_filerrr�make_script�s
rRc	Cs�|tjd}tjj||�}tj|d�}|dkr~|jtj�}t|�dkrr|ddkrrt	t
|��}tjj|�}|}ntjj|�}|j||�|j
�|tjj||�fS)N�ziprF��__pycache__���)rrHrIrJ�zipfile�ZipFile�split�seprrr�basenamerLr?)	�zip_dir�zip_basenamerQZname_in_zip�zip_filename�zip_name�zip_file�partsZ
legacy_pycrrr�make_zip_script�srbr"cCstj|�t|d|�dS)N�__init__)r�mkdirrR)Zpkg_dirZinit_sourcerrr�make_pkg�s
re�cs0g}t|dd�}|j|�tjj|�}	t|||�}
|j|
�|rjtj|dd�}tj|
dd�}
|j||
f��fdd�td|d�D�}tjj	|d
tjj|
��}|tj
d}
tjj	||
�}tj|d	�}x&|D]}tjj	||	�}|j
||�q�W|j
|
|�|j�x|D]}tj|��q
W|tjj	||�fS)Nrcr"T)�doraisecsg|]}tjj�g|��qSr)rrZrJ)�.0�i)�pkg_namerr�
<listcomp>�sz make_zip_pkg.<locals>.<listcomp>rfrSrF���)rRr(rrIr[�
py_compile�compiler,�rangerJrHrWrXrLr?�unlink)r\r]rjrOrPZdepthZcompiledrpZ	init_nameZ
init_basenamerQZ	pkg_namesZscript_name_in_zipr^r_r`�nameZinit_name_in_zipr)rjr�make_zip_pkg�s.



rr)rrr)F)N)r")rfF) �collectionsrMr	rZos.pathZtempfilerrm�
contextlibZshutilrW�importlib.utilrZtest.supportrrrr
�
namedtuplerr6r8r9r:r.ZSTDOUTr>rDrRrbrerrrrrr�<module>s4$3




support/__pycache__/testresult.cpython-36.opt-2.pyc000064400000017012150327172730016304 0ustar003


 \
�@s2ddlZddlZddlZddlZddlZddlZddljjZ	ddl
m
Z
Gdd�dej�ZGdd�d�Z
ddd	�Zdd
d�Zedk�r.Gd
d�dej�Zej�Zejeje��ej�Zeedd�ejD���Zeej�Zeje�Ze dej!��e ddd�x(e	j"ej#��D]Z$e e$j%�dd��qWe �dS)�N)�datetimecs�eZdZdddZdddZ�fdd�Zedd��Z�fd	d
�Zd$dd
�Z	dd�Z
edd��Z�fdd�Z�fdd�Z
�fdd�Z�fdd�Z�fdd�Z�fdd�Zdd�Zd d!�Zd"d#�Z�ZS)%�RegressionTestResult�=�F�
�-cs\t�j||dd�d|_tjd�|_|jjdtj�j	d��d|_
d|_g|_t
|�|_dS)Nr)�stream�descriptions�	verbosityTZ	testsuite�start� )�super�__init__�buffer�ETZElement�_RegressionTestResult__suite�setrZutcnowZ	isoformat�_RegressionTestResult__e�!_RegressionTestResult__start_timeZ_RegressionTestResult__results�bool�_RegressionTestResult__verbose)�selfrr	r
)�	__class__��//usr/lib64/python3.6/test/support/testresult.pyrszRegressionTestResult.__init__cCsLy
|j}Wntk
r"t|�SXy|�Stk
rBt|�SXt|�S)N)�id�AttributeError�str�	TypeError�repr)�cls�testZtest_idrrrZ__getIds


zRegressionTestResult.__getIdcsVt�j|�tj|jd�|_}tj�|_|j	rR|j
j|j|��d��|j
j
�dS)NZtestcasez ... )r
�	startTestr�
SubElementrr�time�perf_counterrrr�write�getDescription�flush)rr!�e)rrrr"+s
zRegressionTestResult.startTestFcKsP|j}d|_|dkrdS|jd|jd|j|���|jd|jdd��|jd|jdd��|jrz|jdtj�|jd��|r�|jdk	r�|jj�j	�}|t
j|d�_|j
dk	r�|j
j�j	�}|t
j|d	�_x�|j�D]t\}}|s�|r�q�t
j||�}	t|d
��r>xD|j�D],\}
}|
�r,|	j|
t|��n
t|�|	_�qWq�t|�|	_q�WdS)N�nameZstatus�run�resultZ	completedr$z0.6fz
system-outz
system-err�items)rr�pop�_RegressionTestResult__getIdrr$r%Z_stdout_buffer�getvalue�rstriprr#�textZ_stderr_bufferr-�hasattrr)rr!Zcapture�argsr)�stdout�stderr�k�vZe2Zk2Zv2rrr�_add_result3s4

z RegressionTestResult._add_resultcCs|jr|jj|�d��dS)Nr)rrr&)r�cZwordrrrZ__writeSszRegressionTestResult.__writecCslt|t�r0|jdkr|j}q8|j�d|j��}nt|�}tj||d�}tj|||�}|dj|�dj|�d�S)N�builtins�.�)�type�messager=)�
isinstancer>�
__module__�__name__r�	traceback�format_exception�join)r Zerr_typeZ	err_valueZerr_tb�typename�msg�tbrrrZ__makeErrorDictWs

z$RegressionTestResult.__makeErrorDictcs4|j|d|j|�d�t�j||�|jdd�dS)NT)�error�E�ERROR)r9�$_RegressionTestResult__makeErrorDictr
�addError�_RegressionTestResult__write)rr!�err)rrrrMjszRegressionTestResult.addErrorcs4|j|d|j|�d�t�j||�|jdd�dS)NT)�output�xzexpected failure)r9rLr
�addExpectedFailurerN)rr!rO)rrrrRosz'RegressionTestResult.addExpectedFailurecs4|j|d|j|�d�t�j||�|jdd�dS)NT)Zfailure�F�FAIL)r9rLr
�
addFailurerN)rr!rO)rrrrUtszRegressionTestResult.addFailurecs2|j||d�t�j||�|jdd|���dS)N)Zskipped�Szskipped )r9r
�addSkiprN)rr!�reason)rrrrWyszRegressionTestResult.addSkipcs&|j|�t�j|�|jdd�dS)Nr<�ok)r9r
�
addSuccessrN)rr!)rrrrZ~s
zRegressionTestResult.addSuccesscs*|j|dd�t�j|�|jdd�dS)NZUNEXPECTED_SUCCESS)Zoutcome�uzunexpected success)r9r
�addUnexpectedSuccessrN)rr!)rrrr\�sz)RegressionTestResult.addUnexpectedSuccesscCs2|jr|jjd�|jd|j�|jd|j�dS)NrrKrT)rrr&�printErrorList�errors�failures)rrrr�printErrors�sz RegressionTestResult.printErrorscCs`xZ|D]R\}}|jj|j�|jj|�d|j|��d��|jj|j�|jjd|�qWdS)Nz: rz%s
)rr&�
separator1r'�
separator2)rZflavorr^r!rOrrrr]�s
z#RegressionTestResult.printErrorListcCsH|j}|jdt|j��|jdtt|j���|jdtt|j���|S)NZtestsr^r_)rrrZtestsRun�lenr^r_)rr)rrr�get_xml_element�s
z$RegressionTestResult.get_xml_element)F)rBrA�__qualname__rarbr�classmethodr/r"r9rNrLrMrRrUrWrZr\r`r]rd�
__classcell__rr)rrrs"
 rc@seZdZddd�Zdd�ZdS)�QuietRegressionTestRunnerFcCst|dd�|_||j_dS)Nr)rr,r)rrrrrrr�sz"QuietRegressionTestRunner.__init__cCs||j�|jS)N)r,)rr!rrrr+�s
zQuietRegressionTestRunner.runN)F)rBrArerr+rrrrrh�s
rhFcCs&|rtjtjt||d�Stjt|d�S)N)Zresultclassrr
)r)�	functools�partial�unittestZTextTestRunnerrrh)r
rrrr�get_test_runner_class�srlcCst||�|�S)N)rl)rr
Zcapture_outputrrr�get_test_runner�srm�__main__c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�	TestTestscCsdS)Nr)rrrr�	test_pass�szTestTests.test_passcCstjd�dS)Ng�?)r$Zsleep)rrrr�test_pass_slow�szTestTests.test_pass_slowcCs*tdtjd�tdtjd�|jd�dS)Nr5)�filer6zfailure message)�print�sysr5r6Zfail)rrrr�	test_fail�szTestTests.test_failcCs(tdtjd�tdtjd�td��dS)Nr5)rrr6z
error message)rsrtr5r6�RuntimeError)rrrr�
test_error�szTestTests.test_errorN)rBrArerprqrurwrrrrro�sroccs|]}|dkVqdS)z-vNr)�.0�arrr�	<genexpr>�srzzOutput:zXML: r=)�end)F)F)&ri�iortr$rCrkZxml.etree.ElementTreeZetreeZElementTreerrZTextTestResultrrhrlrmrBZTestCaseroZ	TestSuiteZsuiteZaddTestZ	makeSuite�StringIOr�sum�argvZ
runner_clsr5Zrunnerr+r,rsr0Ztostringlistrd�s�decoderrrr�<module>s2
	




support/__pycache__/script_helper.cpython-36.opt-1.pyc000064400000015702150327172730016734 0ustar003

�\dh�)�@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZmZdadd�ZGdd�dejdd#��Zdd�Zd
d�Zdd�Zdd�Zejejd�dd�Zdd�Zd$dd�Zd%dd�Zd&dd�Zd'd!d"�ZdS)(�N)�source_from_cache)�make_legacy_pyc�strip_python_stderrcCsVtdkrRdtjkrdadSytjtjdddg�Wntjk
rLdaYnXdatS)a 
    Returns True if our sys.executable interpreter requires environment
    variables in order to be able to run at all.

    This is designed to be used with @unittest.skipIf() to annotate tests
    that need to use an assert_python*() function to launch an isolated
    mode (-I) or no environment mode (-E) sub-interpreter process.

    A normal build & test does not run into this situation but it can happen
    when trying to run the standard library test suite from an interpreter that
    doesn't have an obvious home with Python's current home finding logic.

    Setting PYTHONHOME is one way to get most of the testsuite to run in that
    situation.  PYTHONPATH or PYTHONUSERSITE are other common environment
    variables that might impact whether or not the interpreter can start.
    NZ
PYTHONHOMETz-Ez-czimport sys; sys.exit(0)F)�$__cached_interp_requires_environment�os�environ�
subprocessZ
check_call�sys�
executableZCalledProcessError�rr�2/usr/lib64/python3.6/test/support/script_helper.py� interpreter_requires_environments


r
c@seZdZdZdd�ZdS)�_PythonRunResultz2Helper for reporting Python subprocess run resultscCs�d	}|j|j}}t|�|kr0d||d�}t|�|krNd||d�}|jdd�j�}|jdd�j�}td|j|||f��dS)
z4Provide helpful details about failed subcommand runs�P�ds(... truncated stdout ...)Ns(... truncated stderr ...)�ascii�replacezRProcess return code is %d
command line: %r

stdout:
---
%s
---

stderr:
---
%s
---i@)�out�err�len�decode�rstrip�AssertionError�rc)�self�cmd_line�maxlenrrrrr�fail>sz_PythonRunResult.failN)�__name__�
__module__�__qualname__�__doc__rrrrrr;srrrrc
Ost�}d|kr|jd�}n|o$|}tjddg}|rB|jd�n|rX|rX|jd�|jdd�r�i}tjdkr�tjd|d<n
tjj�}d	|kr�d
|d	<|j	|�|j
|�tj|tj
tj
tj
|d�}|�*z|j�\}}Wd|j�tj�XWdQRX|j}	t|�}t|	||�|fS)NZ
__isolatedz-XZfaulthandlerz-Iz-EZ
__cleanenvZwin32Z
SYSTEMROOT�TERM�)�stdin�stdout�stderr�env)r
�popr	r
�append�platformrr�copy�update�extendr�Popen�PIPEZcommunicate�kill�_cleanup�
returncoderr)
�args�env_varsZenv_required�isolatedrr'�procrrrrrr�run_python_until_end[s:





r7cOs4t||�\}}|jr|s&|jr0|r0|j|�|S)N)r7rr)Zexpected_successr3r4�resrrrr�_assert_python�s
r9cOstd|�|�S)a|
    Assert that running the interpreter with `args` and optional environment
    variables `env_vars` succeeds (rc == 0) and return a (return code, stdout,
    stderr) tuple.

    If the __cleanenv keyword is set, env_vars is used as a fresh environment.

    Python is started in isolated mode (command line option -I),
    except if the __isolated keyword is set to False.
    T)T)r9)r3r4rrr�assert_python_ok�sr:cOstd|�|�S)z�
    Assert that running the interpreter with `args` and optional environment
    variables `env_vars` fails (rc != 0) and return a (return code, stdout,
    stderr) tuple.

    See assert_python_ok() for more options.
    F)F)r9)r3r4rrr�assert_python_failure�sr;)r%r&cOsXtjg}t�s|jd�|j|�|jdttj��}d|d<t	j
|ft	j||d�|��S)z�Run a Python subprocess with the given arguments.

    kw is extra keyword args to pass to subprocess.Popen. Returns a Popen
    object.
    z-Er'Zvt100r")r$r%r&)r	r
r
r)r-�
setdefault�dictrrrr.r/)r%r&r3�kwrr'rrr�spawn_python�s

r?cCs2|jj�|jj�}|jj�|j�tj�|S)z?Run the given Popen process until completion and return stdout.)r$�closer%�read�waitrr1)�p�datarrr�kill_python�s


rEFcCsP|}|s|tjd7}tjj||�}t|ddd�}|j|�|j�tj�|S)N�py�wzutf-8)�encoding)	r�extsep�path�join�open�writer@�	importlib�invalidate_caches)Z
script_dir�script_basename�sourceZomit_suffixZscript_filename�script_nameZscript_filerrr�make_script�s
rSc	Cs�|tjd}tjj||�}tj|d�}|dkr~|jtj�}t|�dkrr|ddkrrt	t
|��}tjj|�}|}ntjj|�}|j||�|j
�|tjj||�fS)N�ziprG��__pycache__���)rrIrJrK�zipfile�ZipFile�split�seprrr�basenamerMr@)	�zip_dir�zip_basenamerRZname_in_zip�zip_filename�zip_name�zip_file�partsZ
legacy_pycrrr�make_zip_script�srcr#cCstj|�t|d|�dS)N�__init__)r�mkdirrS)Zpkg_dirZinit_sourcerrr�make_pkg�s
rf�cs0g}t|dd�}|j|�tjj|�}	t|||�}
|j|
�|rjtj|dd�}tj|
dd�}
|j||
f��fdd�td|d�D�}tjj	|d
tjj|
��}|tj
d}
tjj	||
�}tj|d	�}x&|D]}tjj	||	�}|j
||�q�W|j
|
|�|j�x|D]}tj|��q
W|tjj	||�fS)Nrdr#T)�doraisecsg|]}tjj�g|��qSr)rr[rK)�.0�i)�pkg_namerr�
<listcomp>�sz make_zip_pkg.<locals>.<listcomp>rgrTrG���)rSr)rrJr\�
py_compile�compiler-�rangerKrIrXrYrMr@�unlink)r]r^rkrPrQZdepthZcompiledrqZ	init_nameZ
init_basenamerRZ	pkg_namesZscript_name_in_zipr_r`ra�nameZinit_name_in_zipr)rkr�make_zip_pkg�s.



rs)rrr)F)N)r#)rgF) �collectionsrNr	rZos.pathZtempfilerrn�
contextlibZshutilrX�importlib.utilrZtest.supportrrrr
�
namedtuplerr7r9r:r;r/ZSTDOUTr?rErSrcrfrsrrrr�<module>s4$3




support/__pycache__/script_helper.cpython-36.pyc000064400000015702150327172730015775 0ustar003

�\dh�)�@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZmZdadd�ZGdd�dejdd#��Zdd�Zd
d�Zdd�Zdd�Zejejd�dd�Zdd�Zd$dd�Zd%dd�Zd&dd�Zd'd!d"�ZdS)(�N)�source_from_cache)�make_legacy_pyc�strip_python_stderrcCsVtdkrRdtjkrdadSytjtjdddg�Wntjk
rLdaYnXdatS)a 
    Returns True if our sys.executable interpreter requires environment
    variables in order to be able to run at all.

    This is designed to be used with @unittest.skipIf() to annotate tests
    that need to use an assert_python*() function to launch an isolated
    mode (-I) or no environment mode (-E) sub-interpreter process.

    A normal build & test does not run into this situation but it can happen
    when trying to run the standard library test suite from an interpreter that
    doesn't have an obvious home with Python's current home finding logic.

    Setting PYTHONHOME is one way to get most of the testsuite to run in that
    situation.  PYTHONPATH or PYTHONUSERSITE are other common environment
    variables that might impact whether or not the interpreter can start.
    NZ
PYTHONHOMETz-Ez-czimport sys; sys.exit(0)F)�$__cached_interp_requires_environment�os�environ�
subprocessZ
check_call�sys�
executableZCalledProcessError�rr�2/usr/lib64/python3.6/test/support/script_helper.py� interpreter_requires_environments


r
c@seZdZdZdd�ZdS)�_PythonRunResultz2Helper for reporting Python subprocess run resultscCs�d	}|j|j}}t|�|kr0d||d�}t|�|krNd||d�}|jdd�j�}|jdd�j�}td|j|||f��dS)
z4Provide helpful details about failed subcommand runs�P�ds(... truncated stdout ...)Ns(... truncated stderr ...)�ascii�replacezRProcess return code is %d
command line: %r

stdout:
---
%s
---

stderr:
---
%s
---i@)�out�err�len�decode�rstrip�AssertionError�rc)�self�cmd_line�maxlenrrrrr�fail>sz_PythonRunResult.failN)�__name__�
__module__�__qualname__�__doc__rrrrrr;srrrrc
Ost�}d|kr|jd�}n|o$|}tjddg}|rB|jd�n|rX|rX|jd�|jdd�r�i}tjdkr�tjd|d<n
tjj�}d	|kr�d
|d	<|j	|�|j
|�tj|tj
tj
tj
|d�}|�*z|j�\}}Wd|j�tj�XWdQRX|j}	t|�}t|	||�|fS)NZ
__isolatedz-XZfaulthandlerz-Iz-EZ
__cleanenvZwin32Z
SYSTEMROOT�TERM�)�stdin�stdout�stderr�env)r
�popr	r
�append�platformrr�copy�update�extendr�Popen�PIPEZcommunicate�kill�_cleanup�
returncoderr)
�args�env_varsZenv_required�isolatedrr'�procrrrrrr�run_python_until_end[s:





r7cOs4t||�\}}|jr|s&|jr0|r0|j|�|S)N)r7rr)Zexpected_successr3r4�resrrrr�_assert_python�s
r9cOstd|�|�S)a|
    Assert that running the interpreter with `args` and optional environment
    variables `env_vars` succeeds (rc == 0) and return a (return code, stdout,
    stderr) tuple.

    If the __cleanenv keyword is set, env_vars is used as a fresh environment.

    Python is started in isolated mode (command line option -I),
    except if the __isolated keyword is set to False.
    T)T)r9)r3r4rrr�assert_python_ok�sr:cOstd|�|�S)z�
    Assert that running the interpreter with `args` and optional environment
    variables `env_vars` fails (rc != 0) and return a (return code, stdout,
    stderr) tuple.

    See assert_python_ok() for more options.
    F)F)r9)r3r4rrr�assert_python_failure�sr;)r%r&cOsXtjg}t�s|jd�|j|�|jdttj��}d|d<t	j
|ft	j||d�|��S)z�Run a Python subprocess with the given arguments.

    kw is extra keyword args to pass to subprocess.Popen. Returns a Popen
    object.
    z-Er'Zvt100r")r$r%r&)r	r
r
r)r-�
setdefault�dictrrrr.r/)r%r&r3�kwrr'rrr�spawn_python�s

r?cCs2|jj�|jj�}|jj�|j�tj�|S)z?Run the given Popen process until completion and return stdout.)r$�closer%�read�waitrr1)�p�datarrr�kill_python�s


rEFcCsP|}|s|tjd7}tjj||�}t|ddd�}|j|�|j�tj�|S)N�py�wzutf-8)�encoding)	r�extsep�path�join�open�writer@�	importlib�invalidate_caches)Z
script_dir�script_basename�sourceZomit_suffixZscript_filename�script_nameZscript_filerrr�make_script�s
rSc	Cs�|tjd}tjj||�}tj|d�}|dkr~|jtj�}t|�dkrr|ddkrrt	t
|��}tjj|�}|}ntjj|�}|j||�|j
�|tjj||�fS)N�ziprG��__pycache__���)rrIrJrK�zipfile�ZipFile�split�seprrr�basenamerMr@)	�zip_dir�zip_basenamerRZname_in_zip�zip_filename�zip_name�zip_file�partsZ
legacy_pycrrr�make_zip_script�srcr#cCstj|�t|d|�dS)N�__init__)r�mkdirrS)Zpkg_dirZinit_sourcerrr�make_pkg�s
rf�cs0g}t|dd�}|j|�tjj|�}	t|||�}
|j|
�|rjtj|dd�}tj|
dd�}
|j||
f��fdd�td|d�D�}tjj	|d
tjj|
��}|tj
d}
tjj	||
�}tj|d	�}x&|D]}tjj	||	�}|j
||�q�W|j
|
|�|j�x|D]}tj|��q
W|tjj	||�fS)Nrdr#T)�doraisecsg|]}tjj�g|��qSr)rr[rK)�.0�i)�pkg_namerr�
<listcomp>�sz make_zip_pkg.<locals>.<listcomp>rgrTrG���)rSr)rrJr\�
py_compile�compiler-�rangerKrIrXrYrMr@�unlink)r]r^rkrPrQZdepthZcompiledrqZ	init_nameZ
init_basenamerRZ	pkg_namesZscript_name_in_zipr_r`ra�nameZinit_name_in_zipr)rkr�make_zip_pkg�s.



rs)rrr)F)N)r#)rgF) �collectionsrNr	rZos.pathZtempfilerrn�
contextlibZshutilrX�importlib.utilrZtest.supportrrrr
�
namedtuplerr7r9r:r;r/ZSTDOUTr?rErSrcrfrsrrrr�<module>s4$3




support/__pycache__/testresult.cpython-36.pyc000064400000017130150327172730015345 0ustar003


 \
�@s6dZddlZddlZddlZddlZddlZddlZddljj	Z
ddlmZGdd�dej�Z
Gdd�d�Zdd	d
�Zddd�Zed
k�r2Gdd�dej�Zej�Zejeje��ej�Zeedd�ejD���Zeej�Zeje�Z e!dej"��e!ddd�x(e
j#e j$��D]Z%e!e%j&�dd��qWe!�dS)z=Test runner and result class for the regression test suite.

�N)�datetimecs�eZdZdddZdddZ�fdd�Zedd��Z�fd	d
�Zd$dd
�Z	dd�Z
edd��Z�fdd�Z�fdd�Z
�fdd�Z�fdd�Z�fdd�Z�fdd�Zdd�Zd d!�Zd"d#�Z�ZS)%�RegressionTestResult�=�F�
�-cs\t�j||dd�d|_tjd�|_|jjdtj�j	d��d|_
d|_g|_t
|�|_dS)Nr)�stream�descriptions�	verbosityTZ	testsuite�start� )�super�__init__�buffer�ETZElement�_RegressionTestResult__suite�setrZutcnowZ	isoformat�_RegressionTestResult__e�!_RegressionTestResult__start_timeZ_RegressionTestResult__results�bool�_RegressionTestResult__verbose)�selfrr	r
)�	__class__��//usr/lib64/python3.6/test/support/testresult.pyrszRegressionTestResult.__init__cCsLy
|j}Wntk
r"t|�SXy|�Stk
rBt|�SXt|�S)N)�id�AttributeError�str�	TypeError�repr)�cls�testZtest_idrrrZ__getIds


zRegressionTestResult.__getIdcsVt�j|�tj|jd�|_}tj�|_|j	rR|j
j|j|��d��|j
j
�dS)NZtestcasez ... )r
�	startTestr�
SubElementrr�time�perf_counterrrr�write�getDescription�flush)rr!�e)rrrr"+s
zRegressionTestResult.startTestFcKsP|j}d|_|dkrdS|jd|jd|j|���|jd|jdd��|jd|jdd��|jrz|jdtj�|jd��|r�|jdk	r�|jj�j	�}|t
j|d�_|j
dk	r�|j
j�j	�}|t
j|d	�_x�|j�D]t\}}|s�|r�q�t
j||�}	t|d
��r>xD|j�D],\}
}|
�r,|	j|
t|��n
t|�|	_�qWq�t|�|	_q�WdS)N�nameZstatus�run�resultZ	completedr$z0.6fz
system-outz
system-err�items)rr�pop�_RegressionTestResult__getIdrr$r%Z_stdout_buffer�getvalue�rstriprr#�textZ_stderr_bufferr-�hasattrr)rr!Zcapture�argsr)�stdout�stderr�k�vZe2Zk2Zv2rrr�_add_result3s4

z RegressionTestResult._add_resultcCs|jr|jj|�d��dS)Nr)rrr&)r�cZwordrrrZ__writeSszRegressionTestResult.__writecCslt|t�r0|jdkr|j}q8|j�d|j��}nt|�}tj||d�}tj|||�}|dj|�dj|�d�S)N�builtins�.�)�type�messager=)�
isinstancer>�
__module__�__name__r�	traceback�format_exception�join)r Zerr_typeZ	err_valueZerr_tb�typename�msg�tbrrrZ__makeErrorDictWs

z$RegressionTestResult.__makeErrorDictcs4|j|d|j|�d�t�j||�|jdd�dS)NT)�error�E�ERROR)r9�$_RegressionTestResult__makeErrorDictr
�addError�_RegressionTestResult__write)rr!�err)rrrrMjszRegressionTestResult.addErrorcs4|j|d|j|�d�t�j||�|jdd�dS)NT)�output�xzexpected failure)r9rLr
�addExpectedFailurerN)rr!rO)rrrrRosz'RegressionTestResult.addExpectedFailurecs4|j|d|j|�d�t�j||�|jdd�dS)NT)Zfailure�F�FAIL)r9rLr
�
addFailurerN)rr!rO)rrrrUtszRegressionTestResult.addFailurecs2|j||d�t�j||�|jdd|���dS)N)Zskipped�Szskipped )r9r
�addSkiprN)rr!�reason)rrrrWyszRegressionTestResult.addSkipcs&|j|�t�j|�|jdd�dS)Nr<�ok)r9r
�
addSuccessrN)rr!)rrrrZ~s
zRegressionTestResult.addSuccesscs*|j|dd�t�j|�|jdd�dS)NZUNEXPECTED_SUCCESS)Zoutcome�uzunexpected success)r9r
�addUnexpectedSuccessrN)rr!)rrrr\�sz)RegressionTestResult.addUnexpectedSuccesscCs2|jr|jjd�|jd|j�|jd|j�dS)NrrKrT)rrr&�printErrorList�errors�failures)rrrr�printErrors�sz RegressionTestResult.printErrorscCs`xZ|D]R\}}|jj|j�|jj|�d|j|��d��|jj|j�|jjd|�qWdS)Nz: rz%s
)rr&�
separator1r'�
separator2)rZflavorr^r!rOrrrr]�s
z#RegressionTestResult.printErrorListcCsH|j}|jdt|j��|jdtt|j���|jdtt|j���|S)NZtestsr^r_)rrrZtestsRun�lenr^r_)rr)rrr�get_xml_element�s
z$RegressionTestResult.get_xml_element)F)rBrA�__qualname__rarbr�classmethodr/r"r9rNrLrMrRrUrWrZr\r`r]rd�
__classcell__rr)rrrs"
 rc@seZdZddd�Zdd�ZdS)�QuietRegressionTestRunnerFcCst|dd�|_||j_dS)Nr)rr,r)rrrrrrr�sz"QuietRegressionTestRunner.__init__cCs||j�|jS)N)r,)rr!rrrr+�s
zQuietRegressionTestRunner.runN)F)rBrArerr+rrrrrh�s
rhFcCs&|rtjtjt||d�Stjt|d�S)N)Zresultclassrr
)r)�	functools�partial�unittestZTextTestRunnerrrh)r
rrrr�get_test_runner_class�srlcCst||�|�S)N)rl)rr
Zcapture_outputrrr�get_test_runner�srm�__main__c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�	TestTestscCsdS)Nr)rrrr�	test_pass�szTestTests.test_passcCstjd�dS)Ng�?)r$Zsleep)rrrr�test_pass_slow�szTestTests.test_pass_slowcCs*tdtjd�tdtjd�|jd�dS)Nr5)�filer6zfailure message)�print�sysr5r6Zfail)rrrr�	test_fail�szTestTests.test_failcCs(tdtjd�tdtjd�td��dS)Nr5)rrr6z
error message)rsrtr5r6�RuntimeError)rrrr�
test_error�szTestTests.test_errorN)rBrArerprqrurwrrrrro�sroccs|]}|dkVqdS)z-vNr)�.0�arrr�	<genexpr>�srzzOutput:zXML: r=)�end)F)F)'�__doc__ri�iortr$rCrkZxml.etree.ElementTreeZetreeZElementTreerrZTextTestResultrrhrlrmrBZTestCaseroZ	TestSuiteZsuiteZaddTestZ	makeSuite�StringIOr�sum�argvZ
runner_clsr5Zrunnerr+r,rsr0Ztostringlistrd�s�decoderrrr�<module>s4
	




support/__pycache__/__init__.cpython-36.pyc000064400000236703150327172730014677 0ustar003

�\dh����@s^
dZedkred��ddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZ
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl!Z"ddl#Z#ddl$m%Z%yddl&Z&ddl'Z'Wnek
�rBdZ&dZ'YnXyddl(Z)Wnek
�rjdZ)YnXyddl*Z*Wnek
�r�dZ*YnXyddl+Z+Wnek
�r�dZ+YnXyddl,Z,Wnek
�r�dZ,YnXyddl-Z-Wnek
�r
dZ-YnXyddl.Z.Wnek
�r2dZ.YnXyddl/Z/Wnek
�rZdZ/YnXddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbg\Z0Gdcd�de1�Z2Gddd
�d
e2�Z3Gded�de2�Z4Gdfd�de j5�Z6ej7�dfdhdi��Z8�dgfdk�dld�Z9dmdn�Z:dodp�Z;dqd=�Z<drd>�Z=ffdjfdsd�Z>dtd9�Z?dZ@dZAdaBdaCdZDdjZEdaFdud�ZGdvd�ZHdwd�ZIdxdy�ZJejjKdz��r.�dhd{d|�ZLd}d~�ZMdd��ZNd�d��ZOd�d��ZPnejQZMejRZNd�d��ZOd�d��ZPd�d�ZQd�d��ZRd�d�ZSd�d��ZTd�d�ZUd�d��ZVd�d#�ZW�did�d$�ZXd�d��ZYd�d%�ZZd�d&�Z[d�d'�Z\�djd�d(�Z]d�Z^d�Z_ej`ejafd�dJ�Zbe^fd�dK�Zcd�dM�Zdd�d��Zeee�Zfd�d��Zg�dmZh�dpZie jjekjld��jKd��d��Zme jje*d��Zne jje+d��Zoe jje,d��Zpe jje-d��ZqejjKd��Zrejsd��Ztetdk	�oxetdkZuejd�k�r�eu�r�d�nd�ZvndZvejwd�k�r�d�Zxnd�Zxd�jyexejz��ZxdZ{xL�dqD]BZ|yej}ej~e|��e|k�r�e�Wnek
�rYnXe|Z{P�q�Wexd�Z�ejd�k�r:ddl�Z�e�j�d�e��Z�ej��Z�dZ�ejwd�k�r�ej��jd�k�r�exd�Z�ye�j�e��Wne�k
�r�YnXe�d�e�e�f�dZ�nBejd�k�r�yd�j�e��Wn&e�k
�r�exd�j�e�dǃZ�YnXdZ�xF�drD]<Zwyewj�e��Wn&e�k
�r,ej~ex�ewZ�PYnX�q�We{�rHexd�e{Z�ndZ�ej��Z�djZ�djZ�ej7�dsd�d΄�Z�ej7�dtd�dЄ�Z�ej7�dud�d��Z�e�edӃ�r�ej7d�dN��Z�ej�j�ej�j�e���Z�ej�j�e��Z�ej�j�e�dՃZ��dvd�d�Z�d�d �Z�d�d^�Z�d�dڄZ�dddۜd�d)�Z�d�dL�Z�Gd�d߄d�e��Z��dwd�d�Z�ej7d�dU��Z�ej7d�e�djfd�d��Z�ej7d�dV��Z�Gd�d�de��Z�Gd�dW�dWej�j��Z�Gd�d�d�e��Z�Gd�d*�d*e��Z�e�e�ej�d�Z�e�e�ej�d�Z�e�e�ej�d�Z�ej7d�fd�d�d.��Z�ej7d�d��Z�d�d�Z�d�d�Z�d�d�Z�d�d��Z�ej7d�d���Z�d�d��Z�d�Z�d�Z�e�ed���	rLd�e�Z�d�Z�e��dZd�d�ZÐd�d�ZĐdxZŐdyZƐd�d�Zǐd	dX�ZȐd
d_�ZɐdzZ�d�e�Z�d�e�Z�d�e�Z�ej�Zϐdd\�Z�G�d�d
��d
�Zѐd{�dd6�ZҐdd7�Z�G�dd/�d/�ZԐd�d�ZՐd�d�Z֐ddA�Zאdd8�Zؐd|�d�d�Z�daڐddB�Zېd�d�ZܐddE�Zݐd�d�Zސd�d �Zߐd!�d"�Z�d#�d$�Z�da�da�d%�d&�Z�d'�d(�Z�d)�d*�Z�d+d0�Z�d,�d-�Z�e݃�
o�ejd�k�
o�ejs�d.�Z�e�jdk	�oe�Z�e jje�d/�Z�d}�d0d1�Z�d1�d2�Z�d3�d4�Z�djZ�d5dQ�Z�d6dR�Z�d7dS�Z�ej7�d~�d9�d:��Z�d;dO�Z�ej7�d�d<dT��Z�ej7�d=dZ��Z�ej7�d>dY��Z��d?�d@�Z�e j�e�e�dA��dB�Z��dC�dD�Z��dE�dF�Z�G�dGdP�dPej�j��Z�G�dHd[�d[e���Zd�a�dId!��Z�dJd2��Zd�a�dK�dL��Z�dMd;��Z�dN�dO��Z�dPd"��Zf�dQ��dRd?��Z	dfff�dSd@��Z
G�dTd]�d]��Z�dU�dV��Z�dW�dX��Z
ff�dY�dZ��Zgf�d[da��Zd�a�d\dG��Zej7�d]�d^���Z�d_db��ZG�d`�da��da��ZG�db�dc��dc��Zej7�dd�de���ZdS(�z7Supporting definitions for the Python regression tests.ztest.supportz.support must be imported from the test package�N�)�get_test_runner�
PIPE_MAX_SIZE�verbose�
max_memuse�
use_resources�failfast�Error�
TestFailed�
TestDidNotRun�ResourceDenied�
import_module�import_fresh_module�CleanImport�unload�forget�record_original_stdout�get_original_stdout�captured_stdout�captured_stdin�captured_stderr�TESTFN�SAVEDCWD�unlink�rmtree�temp_cwd�findfile�create_empty_file�can_symlink�fs_is_case_insensitive�is_resource_enabled�requires�requires_freebsd_version�requires_linux_version�requires_mac_ver�requires_hashdigest�check_syntax_error�TransientResource�time_out�socket_peer_reset�ioerror_peer_reset�transient_internet�BasicTestRunner�run_unittest�run_doctest�skip_unless_symlink�
requires_gzip�requires_bz2�
requires_lzma�
bigmemtest�bigaddrspacetest�cpython_only�
get_attribute�requires_IEEE_754�skip_unless_xattr�
requires_zlib�anticipate_failure�load_package_tests�detect_api_mismatch�check__all__�requires_android_level�requires_multiprocessing_queue�	is_jython�
is_android�check_impl_detail�
unix_shell�setswitchinterval�HOST�IPV6_ENABLED�find_unused_port�	bind_port�open_urlresource�bind_unix_socket�
temp_umask�
reap_children�TestHandler�threading_setup�threading_cleanup�reap_threads�
start_threads�check_warnings�check_no_resource_warning�EnvironmentVarGuard�run_with_locale�	swap_item�	swap_attr�Matcher�set_memlimit�SuppressCrashReport�sortdict�run_with_tz�PGO�missing_compiler_executable�fd_countc@seZdZdZdS)r	z*Base class for regression test exceptions.N)�__name__�
__module__�__qualname__�__doc__�rdrd�-/usr/lib64/python3.6/test/support/__init__.pyr	|sc@seZdZdZdS)r
zTest failed.N)r`rarbrcrdrdrdrer
sc@seZdZdZdS)rzTest did not run any subtests.N)r`rarbrcrdrdrdrer�sc@seZdZdZdS)rz�Test skipped because it requested a disallowed resource.

    This is raised when a test calls requires() for a resource that
    has not be enabled.  It is used to distinguish between expected
    and unexpected skips.
    N)r`rarbrcrdrdrdrer�sTccs8|r.tj��tjddt�dVWdQRXndVdS)z�Context manager to suppress package and module deprecation
    warnings when importing them.

    If ignore is False, this context manager has no effect.
    �ignorez.+ (module|package)N)�warnings�catch_warnings�filterwarnings�DeprecationWarning)rfrdrdre�_ignore_deprecated_imports�s
rkF)�required_oncCsft|��Ty
tj|�Stk
rV}z&tjjt|��r8�tj	t
|���WYdd}~XnXWdQRXdS)acImport and return the module to be tested, raising SkipTest if
    it is not available.

    If deprecated is True, any module or package deprecation messages
    will be suppressed. If a module is required on a platform but optional for
    others, set required_on to an iterable of platform prefixes which will be
    compared against sys.platform.
    N)rk�	importlibr
�ImportError�sys�platform�
startswith�tuple�unittest�SkipTest�str)�name�
deprecatedrl�msgrdrdrer
�s	

cCs^|tjkrt|�tj|=x>ttj�D]0}||ks@|j|d�r&tj|||<tj|=q&WdS)zyHelper function to save and remove a module from sys.modules

    Raise ImportError if the module can't be imported.
    �.N)ro�modules�
__import__�listrq)rv�orig_modules�modnamerdrdre�_save_and_remove_module�s
rcCs>d}ytj|||<Wntk
r.d}YnXdtj|<|S)z�Helper function to save and block a module in sys.modules

    Return True if the module was in sys.modules, False otherwise.
    TFN)rorz�KeyError)rvr}Zsavedrdrdre�_save_and_block_module�s

r�cCs|r
tjSdd�S)z�Decorator to mark a test that is known to be broken in some cases

       Any use of this decorator should have a comment identifying the
       associated tracker issue.
    cSs|S)Nrd)�frdrdre�<lambda>�sz$anticipate_failure.<locals>.<lambda>)rsZexpectedFailure)Z	conditionrdrdrer:�scCsF|dkrd}tjjtjjtjjt���}|j|||d�}|j|�|S)z�Generic load_tests implementation for simple test packages.

    Most packages can implement load_tests using this function as follows:

       def load_tests(*args):
           return load_package_tests(os.path.dirname(__file__), *args)
    Nztest*)Z	start_dirZ
top_level_dir�pattern)�os�path�dirname�__file__ZdiscoverZaddTests)Zpkg_dir�loaderZstandard_testsr�Ztop_dirZ
package_testsrdrdrer;�s
cCs�t|���i}g}t||�zfyHx|D]}t||�q&Wx |D]}t||�s>|j|�q>Wtj|�}Wntk
r~d}YnXWdx|j�D]\}	}
|
tj	|	<q�Wx|D]}tj	|=q�WX|SQRXdS)a�Import and return a module, deliberately bypassing sys.modules.

    This function imports and returns a fresh copy of the named Python module
    by removing the named module from sys.modules before doing the import.
    Note that unlike reload, the original module is not affected by
    this operation.

    *fresh* is an iterable of additional module names that are also removed
    from the sys.modules cache before doing the import.

    *blocked* is an iterable of module names that are replaced with None
    in the module cache during the import to ensure that attempts to import
    them raise ImportError.

    The named module and any modules named in the *fresh* and *blocked*
    parameters are saved before starting the import and then reinserted into
    sys.modules when the fresh import is complete.

    Module and package deprecation messages are suppressed during this import
    if *deprecated* is True.

    This function will raise ImportError if the named module cannot be
    imported.
    N)
rkrr��appendrmr
rn�itemsrorz)rvZfreshZblockedrwr}Znames_to_removeZ
fresh_nameZblocked_nameZfresh_moduleZ	orig_name�moduleZname_to_removerdrdrer�s$





cCs>yt||�}Wn&tk
r4tjd||f��YnX|SdS)z?Get an attribute, raising SkipTest if AttributeError is raised.zobject %r has no attribute %rN)�getattr�AttributeErrorrsrt)�objrvZ	attributerdrdrer6s
cCs|adS)N)�_original_stdout)�stdoutrdrdrer0scCs
tptjS)N)r�ror�rdrdrdrer4scCs&ytj|=Wntk
r YnXdS)N)rorzr�)rvrdrdrer7scGsny||�Stk
rh}zDtdkrHtd|jj|f�td|j|f�tj|tj�||�Sd}~XnXdS)N�z%s: %szre-run %s%r)	�OSErrorr�print�	__class__r`r��chmod�stat�S_IRWXU)r��func�args�errrdrdre�
_force_run=sr��wincCs�||�|r|}ntjj|�\}}|p(d}d}x<|dkrjtj|�}|rJ|n||ksVdStj|�|d9}q0Wtjd|tdd�dS)Nryg����MbP?g�?r�z)tests may fail, delete still pending for �)�
stacklevel)	r�r��split�listdir�time�sleeprg�warn�RuntimeWarning)r��pathname�waitallr�rv�timeout�Lrdrdre�_waitforHs



r�cCsttj|�dS)N)r�r�r)�filenamerdrdre�_unlinkisr�cCsttj|�dS)N)r�r��rmdir)r�rdrdre�_rmdirlsr�cs,�fdd��t�|dd�tdd�|�dS)Ncs�x�t|tj|�D]�}tjj||�}ytj|�j}Wn<tk
rn}z td||ft	j
d�d}WYdd}~XnXtj|�r�t
�|dd�t|tj|�qt|tj|�qWdS)Nz-support.rmtree(): os.lstat(%r) failed with %s)�filerT)r�)r�r�r�r��join�lstat�st_moder�r�ro�
__stderr__r��S_ISDIRr�r�r)r�rv�fullname�mode�exc)�
_rmtree_innerrdrer�ps

z_rmtree.<locals>._rmtree_innerT)r�cSst|tj|�S)N)r�r�r�)�prdrdrer�sz_rmtree.<locals>.<lambda>)r�)r�rd)r�re�_rmtreeosr�c
Cs^yddl}Wntk
r Yn:X|jt|�d�}|jjj||t|��}|rZ|d|�S|S)Nrr�)�ctypesrnZcreate_unicode_buffer�len�windll�kernel32ZGetLongPathNameW)r�r��bufferZlengthrdrdre�	_longpath�s
r�csFytj|�dStk
r"YnX�fdd���|�tj|�dS)Nc
s�x~t|tj|�D]l}tjj||�}ytj|�j}Wntk
rJd}YnXtj	|�rn�|�t|tj
|�qt|tj|�qWdS)Nr)r�r�r�r�r�r�r�r�r�r�r�r)r�rvr�r�)r�rdrer��s

z_rmtree.<locals>._rmtree_inner)�shutilrr�r�r�)r�rd)r�rer��s
cCs|S)Nrd)r�rdrdrer��scCs*yt|�Wnttfk
r$YnXdS)N)r��FileNotFoundError�NotADirectoryError)r�rdrdrer�scCs&yt|�Wntk
r YnXdS)N)r�r�)r�rdrdrer��sr�cCs&yt|�Wntk
r YnXdS)N)r�r�)r�rdrdrer�scCsBtjj|�}tjjtjj|��}tjj||d�}tj||�|S)aMove a PEP 3147/488 pyc file to its legacy pyc location.

    :param source: The file system path to the source file.  The source file
        does not need to exist, however the PEP 3147/488 pyc file must exist.
    :return: The file system path to the legacy pyc file.
    �c)	rm�util�cache_from_sourcer�r�r��abspathr��rename)�sourceZpyc_fileZup_oneZ
legacy_pycrdrdre�make_legacy_pyc�s
r�cCs\t|�xNtjD]D}tjj||d�}t|d�x dD]}ttjj||d��q8WqWdS)	z�'Forget' a module was ever imported.

    This removes the module from sys.modules and deletes any PEP 3147/488 or
    legacy .pyc files.
    z.pyr��rr�)�optimizationN)r�rr�)	rror�r�r�rrmr�r�)r~r�r��optrdrdrer�s
cs�ttd�rtjSd}tjjd�r�ddl�ddl�d}d}G�fdd�d�j�}�j	j
}|j�}|sj�j��|�}�j
j�}|j||�j|��j|��j|��}|s��j��t|j|@�s�d}n�tjdk�rVdd	lm}	m�m}
m}dd
lm}|	j|d��}
|
j�dk�rd}nFG�fd
d�d|�}|�}|
|�}|
j|�dk�sR|
j|�dk�rVd}|�s�y.ddlm}|�}|j�|j �|j!�Wn\t"k
�r�}z>t#|�}t$|�dk�r�|dd�d}dj%t&|�j'|�}WYdd}~XnX|t_(|t_tjS)N�resultr�rrcs.eZdZd�jjfd�jjfd�jjfgZdS)z*_is_gui_available.<locals>.USEROBJECTFLAGSZfInheritZ	fReserved�dwFlagsN)r`rarb�wintypesZBOOL�DWORD�_fields_rd)r�rdre�USEROBJECTFLAGS�s

r�z,gui not available (WSF_VISIBLE flag not set)�darwin)�cdll�c_int�pointer�	Structure)�find_libraryZApplicationServicesz0gui tests cannot run without OS X window managercseZdZd�fd�fgZdS)z._is_gui_available.<locals>.ProcessSerialNumberZ
highLongOfPSNZlowLongOfPSNN)r`rarbr�rd)r�rdre�ProcessSerialNumbersr�z#cannot run without OS X gui process)�Tk�2z [...]zTk unavailable due to {}: {}))�hasattr�_is_gui_availabler�rorprqr�Zctypes.wintypesr�r�Zuser32ZGetProcessWindowStationZWinErrorr�r�ZGetUserObjectInformationWZbyrefZsizeof�boolr�r�r�r�Zctypes.utilr�ZLoadLibraryZCGMainDisplayIDZGetCurrentProcessZSetFrontProcessZtkinterr�Zwithdraw�updateZdestroy�	Exceptionrur��format�typer`�reason)r�Z	UOI_FLAGSZWSF_VISIBLEr�Zdll�hZuofZneeded�resr�r�r�r�Zapp_servicesr�ZpsnZpsn_pr��root�eZ
err_stringrd)r�r�rer��sh

r�cCstdkp|tkS)z�Test whether a resource is enabled.

    Known resources are set by regrtest.py.  If not running under regrtest.py,
    all resources are assumed enabled unless use_resources has been set.
    N)r)�resourcerdrdrer $scCs>t|�s |dkrd|}t|��|dkr:t�r:ttj��dS)z@Raise ResourceDenied if the specified resource is not available.Nz"Use of the %r resource not enabled�gui)r rr�r�)r�rxrdrdrer!,scs��fdd�}|S)z�Decorator raising SkipTest if the OS is `sysname` and the version is less
    than `min_version`.

    For example, @_requires_unix_version('FreeBSD', (7, 2)) raises SkipTest if
    the FreeBSD version is less than 7.2.
    cs$tj�����fdd��}�|_|S)Nc
s�tj��krztj�jdd�d}yttt|jd���}Wntk
rLYn.X|�krzdjtt	���}t
jd�||f���||�S)N�-rrryz(%s version %s or higher required, not %s)rp�system�releaser�rr�map�int�
ValueErrorr�rursrt)r��kw�version_txt�version�min_version_txt)r��min_version�sysnamerdre�wrapper=sz:_requires_unix_version.<locals>.decorator.<locals>.wrapper)�	functools�wrapsr�)r�r�)r�r�)r�re�	decorator<sz)_requires_unix_version.<locals>.decoratorrd)r�r�r�rd)r�r�re�_requires_unix_version5sr�cGs
td|�S)z�Decorator raising SkipTest if the OS is FreeBSD and the FreeBSD version is
    less than `min_version`.

    For example, @requires_freebsd_version(7, 2) raises SkipTest if the FreeBSD
    version is less than 7.2.
    ZFreeBSD)r�)r�rdrdrer"PscGs
td|�S)z�Decorator raising SkipTest if the OS is Linux and the Linux version is
    less than `min_version`.

    For example, @requires_linux_version(2, 6, 32) raises SkipTest if the Linux
    version is less than 2.6.32.
    ZLinux)r�)r�rdrdrer#Yscs�fdd�}|S)z�Decorator raising SkipTest if the OS is Mac OS X and the OS X
    version if less than min_version.

    For example, @requires_mac_ver(10, 5) raises SkipTest if the OS X version
    is lesser than 10.5.
    cs"tj����fdd��}�|_|S)Ncsxtjdkrntj�d}yttt|jd���}Wntk
rBYn,X|�krndjtt	���}t
jd||f���||�S)Nr�rryz&Mac OS X %s or higher required, not %s)rorpZmac_verrrr�r�r�r�r�rursrt)r�r�r�r�r�)r�r�rdrer�js
z4requires_mac_ver.<locals>.decorator.<locals>.wrapper)r�r�r�)r�r�)r�)r�rer�isz#requires_mac_ver.<locals>.decoratorrd)r�r�rd)r�rer$bscs��fdd�}|S)a�Decorator raising SkipTest if a hashing algorithm is not available

    The hashing algorithm could be missing or blocked by a strict crypto
    policy.

    If 'openssl' is True, then the decorator checks that OpenSSL provides
    the algorithm. Otherwise the check falls back to built-in
    implementations.

    ValueError: [digital envelope routines: EVP_DigestInit_ex] disabled for FIPS
    ValueError: unsupported hash type md4
    cstj�����fdd��}|S)NcsXy&�rtdk	rtj��n
tj��Wn&tk
rLtjd��d���YnX�||�S)Nz
hash digest 'z' is not available.)�_hashlib�new�hashlibr�rsrt)r��kwargs)�
digestnamer��opensslrdrer��sz7requires_hashdigest.<locals>.decorator.<locals>.wrapper)r�r�)r�r�)rr)r�rer��sz&requires_hashdigest.<locals>.decoratorrd)rrr�rd)rrrer%}s
z	127.0.0.1z::1cCs"tj||�}t|�}|j�~|S)a�
Returns an unused port that should be suitable for binding.  This is
    achieved by creating a temporary socket with the same family and type as
    the 'sock' parameter (default is AF_INET, SOCK_STREAM), and binding it to
    the specified host address (defaults to 0.0.0.0) with the port set to 0,
    eliciting an unused ephemeral port from the OS.  The temporary socket is
    then closed and deleted, and the ephemeral port is returned.

    Either this method or bind_port() should be used for any tests where a
    server socket needs to be bound to a particular port for the duration of
    the test.  Which one to use depends on whether the calling code is creating
    a python socket, or if an unused port needs to be provided in a constructor
    or passed to an external program (i.e. the -accept argument to openssl's
    s_server mode).  Always prefer bind_port() over find_unused_port() where
    possible.  Hard coded ports should *NEVER* be used.  As soon as a server
    socket is bound to a hard coded port, the ability to run multiple instances
    of the test simultaneously on the same host is compromised, which makes the
    test a ticking time bomb in a buildbot environment. On Unix buildbots, this
    may simply manifest as a failed test, which can be recovered from without
    intervention in most cases, but on Windows, the entire python process can
    completely and utterly wedge, requiring someone to log in to the buildbot
    and manually kill the affected process.

    (This is easy to reproduce on Windows, unfortunately, and can be traced to
    the SO_REUSEADDR socket option having different semantics on Windows versus
    Unix/Linux.  On Unix, you can't have two AF_INET SOCK_STREAM sockets bind,
    listen and then accept connections on identical host/ports.  An EADDRINUSE
    OSError will be raised at some point (depending on the platform and
    the order bind and listen were called on each socket).

    However, on Windows, if SO_REUSEADDR is set on the sockets, no EADDRINUSE
    will ever be raised when attempting to bind two identical host/ports. When
    accept() is called on each socket, the second caller's process will steal
    the port from the first caller, leaving them both in an awkwardly wedged
    state where they'll no longer respond to any signals or graceful kills, and
    must be forcibly killed via OpenProcess()/TerminateProcess().

    The solution on Windows is to use the SO_EXCLUSIVEADDRUSE socket option
    instead of SO_REUSEADDR, which effectively affords the same semantics as
    SO_REUSEADDR on Unix.  Given the propensity of Unix developers in the Open
    Source world compared to Windows ones, this is a common mistake.  A quick
    look over OpenSSL's 0.9.8g source shows that they use SO_REUSEADDR when
    openssl.exe is called with the 's_server' option, for example. See
    http://bugs.python.org/issue2550 for more info.  The following site also
    has a very thorough description about the implications of both REUSEADDR
    and EXCLUSIVEADDRUSE on Windows:
    http://msdn2.microsoft.com/en-us/library/ms740621(VS.85).aspx)

    XXX: although this approach is a vast improvement on previous attempts to
    elicit unused ports, it rests heavily on the assumption that the ephemeral
    port returned to us by the OS won't immediately be dished back out to some
    other process when we close and delete our temporary socket but before our
    calling code has a chance to bind the returned port.  We can deal with this
    issue if/when we come across it.
    )�socketrH�close)�familyZsocktypeZtempsock�portrdrdrerG�s
8cCs�|jtjkr�|jtjkr�ttd�r>|jtjtj�dkr>t	d��ttd�r~y |jtjtj
�dkrft	d��Wntk
r|YnXttd�r�|jtjtj
d�|j|df�|j�d}|S)a%Bind the socket to a free port and return the port number.  Relies on
    ephemeral ports in order to ensure we are using an unbound port.  This is
    important as many tests may be running simultaneously, especially in a
    buildbot environment.  This method raises an exception if the sock.family
    is AF_INET and sock.type is SOCK_STREAM, *and* the socket has SO_REUSEADDR
    or SO_REUSEPORT set on it.  Tests should *never* set these socket options
    for TCP/IP sockets.  The only case for setting these options is testing
    multicasting via multiple UDP sockets.

    Additionally, if the SO_EXCLUSIVEADDRUSE socket option is available (i.e.
    on Windows), it will be set on the socket.  This will prevent anyone else
    from bind()'ing to our host/port for the duration of the test.
    �SO_REUSEADDRrzHtests should never set the SO_REUSEADDR socket option on TCP/IP sockets!�SO_REUSEPORTzHtests should never set the SO_REUSEPORT socket option on TCP/IP sockets!�SO_EXCLUSIVEADDRUSEr)rr�AF_INETr��SOCK_STREAMr�Z
getsockoptZ
SOL_SOCKETrr
rr�Z
setsockoptr�bindZgetsockname)�sock�hostrrdrdrerH�s


cCsJ|jtjkst�y|j|�Wn&tk
rD|j�tjd��YnXdS)zBBind a unix socket, raising SkipTest if PermissionError is raised.zcannot bind AF_UNIX socketsN)	rrZAF_UNIX�AssertionErrorr�PermissionErrorrrsrt)rZaddrrdrdrerJscCsZtjrVd}z<y"tjtjtj�}|jtdf�dStk
rBYnXWd|rT|j�XdS)z+Check whether IPv6 is enabled on this host.NrTF)rZhas_ipv6ZAF_INET6r
r�HOSTv6r�r)rrdrdre�_is_ipv6_enableds

rcstj���fdd��}|S)z5Skip the test on TLS certificate validation failures.csNy�||�Wn:tk
rH}zdt|�kr6tjd���WYdd}~XnXdS)NZCERTIFICATE_VERIFY_FAILEDz.system does not contain necessary certificates)�IOErrorrursrt)r�r�r�)r�rdre�decs
z&system_must_validate_cert.<locals>.dec)r�r�)r�rrd)r�re�system_must_validate_certs	rr�i�ZdoubleZIEEEztest requires IEEE 754 doublesz
requires zlibz
requires gzipzrequires bz2z
requires lzma�java�ANDROID_API_LEVEL�win32z/system/bin/shz/bin/shz$testz@testz	{}_{}_tmp�æ�İ�Ł�φ�К�א�،�ت�ก� �€u-àòɘŁğr�ZNFD�ntr�u-共Ł♡ͣ�ztWARNING: The filename %r CAN be encoded by the filesystem encoding (%s). Unicode filename tests may not be effective��s-��surrogateescape��w����������r�ccs�d}|dkr&tj�}d}tjj|�}nBytj|�d}Wn.tk
rf|sN�tjd|t	dd�YnX|rttj
�}z
|VWd|r�|tj
�kr�t|�XdS)a�Return a context manager that creates a temporary directory.

    Arguments:

      path: the directory to create temporarily.  If omitted or None,
        defaults to creating a temporary directory using tempfile.mkdtemp.

      quiet: if False (the default), the context manager raises an exception
        on error.  Otherwise, if the path is specified and cannot be
        created, only a warning is issued.

    FNTz+tests may fail, unable to create temp dir: �)r�)�tempfile�mkdtempr�r��realpath�mkdirr�rgr�r��getpidr)r��quietZdir_created�pidrdrdre�temp_dir�s&


r3ccsftj�}ytj|�Wn.tk
rD|s,�tjd|tdd�YnXztj�VWdtj|�XdS)agReturn a context manager that changes the current working directory.

    Arguments:

      path: the directory to use as the temporary current working directory.

      quiet: if False (the default), the context manager raises an exception
        on error.  Otherwise, it issues only a warning and keeps the current
        working directory the same.

    z)tests may fail, unable to change CWD to: r+)r�N)r��getcwd�chdirr�rgr�r�)r�r1Z	saved_dirrdrdre�
change_cwd	s

r6�tempcwdccs:t||d��$}t||d��}|VWdQRXWdQRXdS)a�
    Context manager that temporarily creates and changes the CWD.

    The function temporarily changes the current working directory
    after creating a temporary directory in the current directory with
    name *name*.  If *name* is None, the temporary directory is
    created using tempfile.mkdtemp.

    If *quiet* is False (default) and it is not possible to
    create or change the CWD, an error is raised.  If *quiet* is True,
    only a warning is raised and the original CWD is used.

    )r�r1)r1N)r3r6)rvr1Z	temp_pathZcwd_dirrdrdrer$s�umaskccs&tj|�}z
dVWdtj|�XdS)z8Context manager that temporarily sets the process umask.N)r�r8)r8ZoldmaskrdrdrerK8s

�datacCsbtjj|�r|S|dk	r&tjj||�}tgtj}x*|D]"}tjj||�}tjj|�r8|Sq8W|S)a[Try to find a file on sys.path or in the test directory.  If it is not
    found the argument passed to the function is returned (this does not
    necessarily signal failure; could still be the legitimate path).

    Setting *subdir* indicates a relative path to use to find the file
    rather than looking directly in the path directories.
    N)r�r��isabsr��
TEST_HOME_DIRro�exists)r�Zsubdirr�Zdn�fnrdrdrerIs
cCs(tj|tjtjBtjB�}tj|�dS)z>Create an empty file. If the file already exists, truncate it.N)r��open�O_WRONLY�O_CREAT�O_TRUNCr)r��fdrdrdrer[scCs,t|j��}dd�|D�}dj|�}d|S)z%Like repr(dict), but in sorted order.cSsg|]}d|�qS)z%r: %rrd)�.0Zpairrdrdre�
<listcomp>cszsortdict.<locals>.<listcomp>z, z{%s})�sortedr�r�)�dictr�Z	reprpairsZ
withcommasrdrdrer[`s
cCs*ttd�}z|j�S|j�tt�XdS)z`
    Create an invalid file descriptor by opening and closing a file and return
    its fd.
    �wbN)r>r�filenorr)r�rdrdre�make_bad_fdgs

rI)�lineno�offsetcCsp|jt��}t|dd�WdQRX|j}|j|j�|dk	rJ|j|j|�|j|j�|dk	rl|j|j|�dS)Nz
<test string>�exec)�assertRaises�SyntaxError�compileZ	exceptionZassertIsNotNonerJ�assertEqualrK)�testcaseZ	statementrJrK�cmr�rdrdrer&sscsVddl}ddl}�jdd��|jj|�djd�d}tjjt	|�}���fdd�}tjj
|�r|||�}|dk	rt|St|�td�t
r�td	|t�d
�|jj�}tr�|jjd�|j|d
d�}tr�|jjd�dkr�tj|d�}zBt|d��.}	|j�}
x|
�r|	j|
�|j�}
�q�WWdQRXWd|j�X||�}|dk	�rF|Std|��dS)Nr�checkr��/rcs>t|f����}�dkr|S�|�r2|jd�|S|j�dS)Nr)r>�seekr)r=r�)r�rSr�rdre�check_valid_file�s
z*open_urlresource.<locals>.check_valid_fileZurlfetchz	fetching %s ...)r��Accept-Encoding�gzip�)r�zContent-Encoding)ZfileobjrGzinvalid resource %r���)rWrX)Zurllib.requestZurllib.parse�pop�parseZurlparser�r�r�r��
TEST_DATA_DIRr<rr!rr�rZrequestZbuild_openerrXZ
addheadersr�r>Zheaders�getZGzipFile�read�writerr
)Zurlr�r��urllibr�r=rVr��opener�out�srd)r�rSr�rerI~s<	



c@s4eZdZdZdd�Zdd�Zedd��Zdd	�Zd
S)�WarningsRecorderzyConvenience wrapper for the warnings list returned on
       entry to the warnings.catch_warnings() context manager.
    cCs||_d|_dS)Nr)�	_warnings�_last)�selfZ
warnings_listrdrdre�__init__�szWarningsRecorder.__init__cCsDt|j�|jkr t|jd|�S|tjjkr0dStd||f��dS)Nrz%r has no attribute %rrZ)r�rfrgr�rg�WarningMessage�_WARNING_DETAILSr�)rh�attrrdrdre�__getattr__�s
zWarningsRecorder.__getattr__cCs|j|jd�S)N)rfrg)rhrdrdrerg�szWarningsRecorder.warningscCst|j�|_dS)N)r�rfrg)rhrdrdre�reset�szWarningsRecorder.resetN)	r`rarbrcrirm�propertyrgrnrdrdrdrere�s
rec
cs
tjd�}|jjd�}|r"|j�tjdd�� }tjdjd�t	|�VWdQRXt
|�}g}xz|D]r\}}d}	xH|dd�D]8}|j}
tj
|t|
�tj�r�t|
j|�r�d}	|j|�q�W|	rf|rf|j||jf�qfW|r�td	|d
��|�rtd|d
��dS)z�Catch the warnings, then check if all the expected
    warnings have been raised and re-raise unexpected warnings.
    If 'quiet' is True, only re-raise the unexpected warnings.
    r�Z__warningregistry__T)�recordrg�alwaysNFzunhandled warning %srz)filter (%r, %s) did not catch any warning)ro�	_getframe�	f_globalsr^�clearrgrhrz�simplefilterrer|�message�re�matchru�I�
issubclassr��remover�r`r)�filtersr1�frame�registry�wZreraiseZmissingrx�cat�seenZwarningrdrdre�_filterwarnings�s0
r�cOs.|jd�}|s$dtff}|dkr$d}t||�S)a�Context manager to silence warnings.

    Accept 2-tuples as positional arguments:
        ("message regexp", WarningCategory)

    Optional argument:
     - if 'quiet' is True, it does not fail if a filter catches nothing
        (default True without argument,
         default False if some filters are defined)

    Without argument, it defaults to:
        check_warnings(("", Warning), quiet=True)
    r1r�NT)r^�Warningr�)r|r�r1rdrdrerR�s

r�ccsHtjdd��&}tjd||d�dV|r.t�WdQRX|j|g�dS)a�Context manager to check that no warnings are emitted.

    This context manager enables a given warning within its scope
    and checks that no warnings are emitted even with that warning
    enabled.

    If force_gc is True, a garbage collection is attempted before checking
    for warnings. This may help to catch warnings emitted when objects
    are deleted, such as ResourceWarning.

    Other keyword arguments are passed to warnings.filterwarnings().
    T)rprq)rv�categoryN)rgrhri�
gc_collectrP)rQrvr�Zforce_gc�warnsrdrdre�check_no_warningssr�ccsBtjdd�� }tjdtd�dVt�WdQRX|j|g�dS)a"Context manager to check that no ResourceWarning is emitted.

    Usage:

        with check_no_resource_warning(self):
            f = open(...)
            ...
            del f

    You must remove the object which may emit ResourceWarning before
    the end of the context manager.
    T)rprq)r�N)rgrhri�ResourceWarningr�rP)rQr�rdrdrerSs
c@s(eZdZdZdd�Zdd�Zdd�ZdS)	ra,Context manager to force import to return a new module reference.

    This is useful for testing module-level behaviours, such as
    the emission of a DeprecationWarning on import.

    Use like this:

        with CleanImport("foo"):
            importlib.import_module("foo") # new reference
    cGsNtjj�|_x<|D]4}|tjkrtj|}|j|kr>tj|j=tj|=qWdS)N)rorz�copy�original_modulesr`)rhZmodule_namesZmodule_namer�rdrdreri?s




zCleanImport.__init__cCs|S)Nrd)rhrdrdre�	__enter__LszCleanImport.__enter__cGstjj|j�dS)N)rorzr�r�)rh�
ignore_excrdrdre�__exit__OszCleanImport.__exit__N)r`rarbrcrir�r�rdrdrdrer3s

c@sheZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)rTz_Class to help protect the environment variable properly.  Can be used as
    a context manager.cCstj|_i|_dS)N)r��environ�_environ�_changed)rhrdrdreriXszEnvironmentVarGuard.__init__cCs
|j|S)N)r�)rh�envvarrdrdre�__getitem__\szEnvironmentVarGuard.__getitem__cCs*||jkr|jj|�|j|<||j|<dS)N)r�r�r^)rhr��valuerdrdre�__setitem___s
zEnvironmentVarGuard.__setitem__cCs2||jkr|jj|�|j|<||jkr.|j|=dS)N)r�r�r^)rhr�rdrdre�__delitem__es

zEnvironmentVarGuard.__delitem__cCs
|jj�S)N)r��keys)rhrdrdrer�lszEnvironmentVarGuard.keyscCs
t|j�S)N)�iterr�)rhrdrdre�__iter__oszEnvironmentVarGuard.__iter__cCs
t|j�S)N)r�r�)rhrdrdre�__len__rszEnvironmentVarGuard.__len__cCs|||<dS)Nrd)rhr�r�rdrdre�setuszEnvironmentVarGuard.setcCs
||=dS)Nrd)rhr�rdrdre�unsetxszEnvironmentVarGuard.unsetcCs|S)Nrd)rhrdrdrer�{szEnvironmentVarGuard.__enter__cGsJx<|jj�D].\}}|dkr0||jkr:|j|=q||j|<qW|jt_dS)N)r�r�r�r�r�)rhr��k�vrdrdrer�~s

zEnvironmentVarGuard.__exit__N)r`rarbrcrir�r�r�r�r�r�r�r�r�r�rdrdrdrerTSsc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�
DirsOnSysPatha�Context manager to temporarily add directories to sys.path.

    This makes a copy of sys.path, appends any directories given
    as positional arguments, then reverts sys.path to the copied
    settings when the context ends.

    Note that *all* sys.path modifications in the body of the
    context manager, including replacement of the object,
    will be reverted at the end of the block.
    cGs(tjdd�|_tj|_tjj|�dS)N)ror��original_value�original_object�extend)rh�pathsrdrdreri�szDirsOnSysPath.__init__cCs|S)Nrd)rhrdrdrer��szDirsOnSysPath.__enter__cGs|jt_|jtjdd�<dS)N)r�ror�r�)rhr�rdrdrer��szDirsOnSysPath.__exit__N)r`rarbrcrir�r�rdrdrdrer��s
r�c@s*eZdZdZdd�Zdd�Zd	dd�ZdS)
r'z�Raise ResourceDenied if an exception is raised while the context manager
    is in effect that matches the specified exception and attributes.cKs||_||_dS)N)r��attrs)rhr�r�rdrdreri�szTransientResource.__init__cCs|S)Nrd)rhrdrdrer��szTransientResource.__enter__NcCsT|dk	rPt|j|�rPx:|jj�D]$\}}t||�s4Pt||�|kr Pq Wtd��dS)z�If type_ is a subclass of self.exc and value has attributes matching
        self.attrs, raise ResourceDenied.  Otherwise let the exception
        propagate (if any).Nz%an optional resource is not available)rzr�r�r�r�r�r)rhZtype_r��	tracebackrlZ
attr_valuerdrdrer��s
zTransientResource.__exit__)NNN)r`rarbrcrir�r�rdrdrdrer'�s)�errnog>@)r��errnosc	#spd!d"d#d$d%d&g}d(d*d,d.d/g}td|��|�g��sRdd�|D��dd�|D�����fdd�}tj�}z�y|dk	r�tj|�dVWn�tjk
�r�}z&tr�tjj	�j
dd��|�WYdd}~Xn�tk
�rZ}zpx^|j
}t|�d k�rt
|dt��r|d}n*t|�dk�r8t
|d t��r8|d }nP�q�W||��WYdd}~XnXWdtj|�XdS)0z�Return a context manager that raises ResourceDenied when various issues
    with the Internet connection manifest themselves as exceptions.�ECONNREFUSED�o�
ECONNRESET�h�EHOSTUNREACH�q�ENETUNREACH�e�	ETIMEDOUT�n�
EADDRNOTAVAIL�c�	EAI_AGAINr+�EAI_FAILr��
EAI_NONAMEr��
EAI_NODATA��
WSANO_DATA�*zResource %r is not availablecSsg|]\}}tt||��qSrd)r�r�)rCrv�numrdrdrerD�sz&transient_internet.<locals>.<listcomp>cSsg|]\}}tt||��qSrd)r�r)rCrvr�rdrdrerD�scs�t|dd�}t|tj�s�t|tj�r,|�ks�t|tjj�rTd|jkoNdkns�t|tjj	�r�d|j
ks�d|j
ks�d|j
ks�|�kr�ts�tj
j�jdd��|�dS)	Nr�i�iW�ConnectionRefusedError�TimeoutError�EOFErrorr�
)r��
isinstancerr�Zgaierrorra�errorZ	HTTPError�codeZURLErrorr�rro�stderrr`r�)r��n)�captured_errnos�denied�
gai_errnosrdre�filter_error�s


z(transient_internet.<locals>.filter_errorNrr�r)r�r�)r�r�)r�r�)r�r�)r�r�)r�r����)r�r����)r�r����)r�r����)r�r�)r�r�)rrZgetdefaulttimeoutZsetdefaulttimeout�nntplibZNNTPTemporaryErrorrror�r`r�r�r�r�)	Z
resource_namer�r�Zdefault_errnosZdefault_gai_errnosr�Zold_timeoutr��ard)r�r�r�rer+�sP



c
csFddl}tt|�}tt||j��ztt|�VWdtt||�XdS)z�Return a context manager used by captured_stdout/stdin/stderr
    that temporarily replaces the sys stream *stream_name* with a StringIO.rN)�ior�ro�setattr�StringIO)Zstream_namer�Zorig_stdoutrdrdre�captured_outputs
r�cCstd�S)z�Capture the output of sys.stdout:

       with captured_stdout() as stdout:
           print("hello")
       self.assertEqual(stdout.getvalue(), "hello\n")
    r�)r�rdrdrdrerscCstd�S)z�Capture the output of sys.stderr:

       with captured_stderr() as stderr:
           print("hello", file=sys.stderr)
       self.assertEqual(stderr.getvalue(), "hello\n")
    r�)r�rdrdrdrer%scCstd�S)a	Capture the input to sys.stdin:

       with captured_stdin() as stdin:
           stdin.write('hello\n')
           stdin.seek(0)
           # call test code that consumes from sys.stdin
           captured = input()
       self.assertEqual(captured, "hello")
    �stdin)r�rdrdrdrer.s
cCs*tj�trtjd�tj�tj�dS)a�Force as many objects as possible to be collected.

    In non-CPython implementations of Python, this is needed because timely
    deallocation is not guaranteed by the garbage collector.  (Even in CPython
    this can be the case in case of reference cycles.)  This means that __del__
    methods may be called later than expected and weakrefs may remain alive for
    longer than expected.  This function tries its best to force all garbage
    objects to disappear.
    g�������?N)�gcZcollectr@r�r�rdrdrdrer�;s


r�c
cs.tj�}tj�z
dVWd|r(tj�XdS)N)r��	isenabled�disable�enable)Zhave_gcrdrdre�
disable_gcKs
r�cCs:tjd�pd}d}x|j�D]}|jd�r|}qW|dkS)z,Find if Python was built with optimizations.�	PY_CFLAGSr�z-O�-O0�-Og)r�r�r�)�	sysconfig�get_config_varr�rq)ZcflagsZ	final_optr�rdrdre�python_is_optimizedVs
r�ZnPZ0n�gettotalrefcountZ2PZ0Pr�cCstjt|t�S)N)�struct�calcsize�_header�_align)�fmtrdrdre�calcobjsizegsr�cCstjt|t�S)N)r�r��_vheaderr�)r�rdrdre�calcvobjsizejsr���	cCspddl}tj|�}t|�tkr(|jt@sBt|�tkrLt|�jt@rL||j7}dt|�||f}|j|||�dS)Nrz&wrong size for %s: got %d, expected %d)	�	_testcapiro�	getsizeofr��	__flags__�_TPFLAGS_HEAPTYPE�_TPFLAGS_HAVE_GCZSIZEOF_PYGC_HEADrP)�test�o�sizer�r�rxrdrdre�check_sizeofqs

r�cs��fdd�}|S)Ncs$���fdd�}�j|_�j|_|S)Ncs�y ddl}t|��}|j|�}Wn(tk
r6�YnBd}}Yn0Xx,�D]$}y|j||�PWqPYqPXqPWz
�||�S|r�|r�|j||�XdS)Nr)�localer��	setlocaler�)r��kwdsr�r�Zorig_locale�loc)�catstrr��localesrdre�inner�s$



z1run_with_locale.<locals>.decorator.<locals>.inner)r`rc)r�r�)r�r�)r�rer��sz"run_with_locale.<locals>.decoratorrd)r�r�r�rd)r�r�rerU�scs�fdd�}|S)Ncs"��fdd�}�j|_�j|_|S)Ncs�y
tj}Wntk
r(tjd��YnXdtjkr@tjd}nd}�tjd<|�z
�||�S|dkrrtjd=n
|tjd<tj�XdS)Nztzset requiredZTZ)r��tzsetr�rsrtr�r�)r�r�r�Zorig_tz)r��tzrdrer��s





z-run_with_tz.<locals>.decorator.<locals>.inner)r`rc)r�r�)r�)r�rer��szrun_with_tz.<locals>.decoratorrd)r�r�rd)r�rer\�scCs�dttdtd�}tjd|tjtjB�}|dkr>td|f��tt|j	d��||j	d�j
��}|a|tkrrt}|t
dkr�td|f��|adS)Ni)r��m�g�tz(\d+(\.\d+)?) (K|M|G|T)b?$zInvalid memory limit %rrr+z$Memory limit %r too low to be useful)�_1M�_1Grwrx�
IGNORECASE�VERBOSEr�r��float�group�lower�real_max_memuse�MAX_Py_ssize_t�_2Gr)�limitZsizesr�ZmemlimitrdrdrerY�s$c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_MemoryWatchdogz`An object which periodically watches the process' memory consumption
    and prints it out.
    cCsdjtj�d�|_d|_dS)Nz/proc/{pid}/statm)r2F)r�r�r0�procfile�started)rhrdrdreri�sz_MemoryWatchdog.__init__cCs�yt|jd�}Wn<tk
rL}z tjdj|�t�tjj	�dSd}~XnXt
d�}tjtj
|g|tjd�|_|j�d|_dS)N�rz!/proc not available for stats: {}zmemory_watchdog.py)r�r�T)r>r
r�rgr�r�r�ror��flushr�
subprocess�Popen�
executableZDEVNULL�mem_watchdogrr)rhr�r�Zwatchdog_scriptrdrdre�start�s
z_MemoryWatchdog.startcCs|jr|jj�|jj�dS)N)rrZ	terminate�wait)rhrdrdre�stop�s
z_MemoryWatchdog.stopN)r`rarbrcrirrrdrdrdrer	�sr	cs���fdd�}|S)atDecorator for bigmem tests.

    'size' is a requested size for the test (in arbitrary, test-interpreted
    units.) 'memuse' is the number of bytes per unit for the test, or a good
    estimate of it. For example, a test that needs two byte buffers, of 4 GiB
    each, could be decorated with @bigmemtest(size=_4G, memuse=2).

    The 'size' argument is normally passed to the decorated test method as an
    extra argument. If 'dry_run' is true, the value passed to the test method
    may be less than the requested value. If 'dry_run' is false, it means the
    test doesn't support dummy runs when -M is not specified.
    cs ���fdd����_��_�S)Nc
s��j}�j}tsd}n|}ts$�rFt||krFtjd||d��tr|tr|t�tdj||dd��t�}|j	�nd}z
�||�S|r�|j
�XdS)	Niz'not enough memory: %.1fG minimum neededir+z* ... expected peak memory use: {peak:.1f}G)Zpeaki@i@)r��memuserrsrtrr�r�r	rr)rhr�r�maxsizeZwatchdog)�dry_runr�r�rdrer�s*


z.bigmemtest.<locals>.decorator.<locals>.wrapper)r�r)r�)rrr�)r�r�rer�szbigmemtest.<locals>.decoratorrd)r�rrr�rd)rrr�rer3s
!cs�fdd�}|S)z0Decorator for tests that fill the address space.csDttkr8td
kr$tdkr$tjd��q@tjdtd��n�|�SdS)
Nr��?r�z-not enough memory: try a 32-bit build insteadz'not enough memory: %.1fG minimum neededir+ll����li@)rrrsrt)rh)r�rdrer�3sz!bigaddrspacetest.<locals>.wrapperrd)r�r�rd)r�rer41sc@seZdZdd�ZdS)r,cCstj�}||�|S)N)rsZ
TestResult)rhr�r�rdrdre�runDszBasicTestRunner.runN)r`rarbrrdrdrdrer,CscCs|S)Nrd)r�rdrdre�_idIsrcCs<|dkrt�rtjtj�St|�r(tStjdj|��SdS)Nr�zresource {0!r} is not enabled)r�rs�skipr�r rr�)r�rdrdre�requires_resourceLs
rcCs&trt|krtjd|tf�StSdS)Nz%s at Android API level %d)rA�_ANDROID_API_LEVELrsrr)�levelr�rdrdrer>TscCstdd�|�S)z9
    Decorator for tests only applicable on CPython.
    T)�cpython)�impl_detail)r�rdrdrer5[scKsVtf|�rtS|dkrLt|�\}}|r,d}nd}t|j��}|jdj|��}tj|�S)Nz*implementation detail not available on {0}z%implementation detail specific to {0}z or )	rBr�
_parse_guardsrEr�r�r�rsr)rx�guardsZ
guardnames�defaultrdrdrer!as
r!cCsTtdkr:ddl}y|j�daWntk
r8daYnXd}trF|Stj|�|�S)z8Skip decorator for tests that use multiprocessing.Queue.NrTFz6requires a functioning shared semaphore implementation)�_have_mp_queue�multiprocessingZQueuernrsr)r�r&rxrdrdrer?os
cCsH|sddidfSt|j��d}t|j��|gt|�ks>t�||fS)Nr TFr)r|�valuesr�r)r#Zis_truerdrdrer"~s
r"cKs t|�\}}|jtj�j�|�S)a5This function returns True or False depending on the host platform.
       Examples:
          if check_impl_detail():               # only on CPython (default)
          if check_impl_detail(jython=True):    # only on Jython
          if check_impl_detail(cpython=False):  # everywhere except on CPython
    )r"r^rpZpython_implementationr)r#r$rdrdrerB�scs,ttd�s�Stj���fdd��}|SdS)zEDecorator to temporarily turn off tracing for the duration of a test.�gettracecs.tj�}ztjd��||�Stj|�XdS)N)ror(�settrace)r�r�Zoriginal_trace)r�rdrer��s


zno_tracing.<locals>.wrapperN)r�ror�r�)r�r�rd)r�re�
no_tracing�s
r*cCstt|��S)aDecorator for tests which involve reference counting.

    To start, the decorator does not run the test if is not run by CPython.
    After that, any trace function is unset during the test to prevent
    unexpected refcounts caused by the trace function.

    )r*r5)r�rdrdre�
refcount_test�sr+cCsRg}xB|jD]8}t|tj�r2t||�|j|�q||�r|j|�qW||_dS)z>Recursively filter test cases in a suite based on a predicate.N)Z_testsr�rs�	TestSuite�
_filter_suiter�)�suiteZpredZnewtestsr�rdrdrer-�s
r-cCs�ttjttdk	d�}|j|�}tdk	r4tj|j��|js>t	�|j
�s�t|j�dkrl|j
rl|jdd}n6t|j
�dkr�|jr�|j
dd}nd}ts�|d7}t|��dS)z2Run tests from a unittest.TestSuite-derived class.N)�	verbosityZcapture_outputrrzmultiple errors occurredz!; run in verbose mode for details)rror�r�junit_xml_listrr�Zget_xml_elementZtestsRunrZ
wasSuccessfulr��errorsZfailuresr
)r.Zrunnerr�r�rdrdre�
_run_suite�s"
r2cCstdkrdSt|j��SdS)NT)�_match_test_func�id)r�rdrdre�
match_test�sr5cCsd|kotjd|�S)Nryz[?*\[\]])rw�search)r�rdrdre�_is_full_match_test�sr7csr|tkrdS|sd}f}nHttt|��r4t|�j}n.djttj|��}t	j
|�j��fdd�}|}t|�a|a
dS)N�|cs$�|�rdStt�|jd���SdS)NTry)�anyr�r�)Ztest_id)�regex_matchrdre�match_test_regex�sz)set_match_tests.<locals>.match_test_regex)�_match_test_patterns�allr�r7r��__contains__r��fnmatch�	translaterwrOrxrrr3)Zpatternsr�Zregexr;rd)r:re�set_match_tests�srAcGs�tjtjf}tj�}xh|D]`}t|t�rT|tjkrJ|jtjtj|��qzt	d��qt||�rj|j|�q|jtj
|��qWt|t�t
|�dS)z1Run tests from unittest.TestCase-derived classes.z)str arguments must be keys in sys.modulesN)rsr,ZTestCaser�rurorzZaddTestZ
findTestCasesr�Z	makeSuiter-r5r2)�classesZvalid_typesr.�clsrdrdrer-s





cCsdS)z,Just used to check if docstrings are enabledNrdrdrdrdre�_check_docstrings(srD�WITH_DOC_STRINGSztest requires docstringscCs`ddl}|dkrt}nd}|j|||d�\}}|rBtd||f��trXtd|j|f�||fS)aRun doctest on the given module.  Return (#failures, #tests).

    If optional argument verbosity is not specified (or is None), pass
    support's belief about verbosity on to doctest.  Else doctest's
    usual behavior is used (it searches sys.argv for -v).
    rN)r�optionflagsz%d of %d doctests failedz,doctest (%s) ... %d tests with zero failures)�doctestrZtestmodr
r�r`)r�r/rFrGr�r�rdrdrer.9scCstjj�fS)N)rorzr�rdrdrdre�
modules_setupTsrHcCs:dd�tjj�D�}tjj�tjj|�tjj|�dS)NcSs"g|]\}}|jd�r||f�qS)z
encodings.)rq)rCr�r�rdrdrerD[sz#modules_cleanup.<locals>.<listcomp>)rorzr�rtr�)Z
oldmodulesZ	encodingsrdrdre�modules_cleanupWs
rIcCs"trtj�tjj�fSdffSdS)Nr)�_thread�_count�	threading�	_danglingr�rdrdrdrerNzscGsJtsdSd}x8t|�D],}tj�tjf}||kr2Ptjd�t�qWdS)N�dg{�G�z�?)rJ�rangerKrLrMr�r�r�)Zoriginal_valuesZ
_MAX_COUNT�countr'rdrdrerO�s
cs"ts�Stj���fdd��}|S)z�Use this function when threads are being used.  This will
    ensure that the threads are cleaned up even when the test fails.
    If threading is unavailable this function does nothing.
    cst�}z�|�St|�XdS)N)rNrO)r��key)r�rdrer��szreap_threads.<locals>.decorator)rJr�r�)r�r�rd)r�rerP�s�N@ccs�tj�}z
dVWdtj�}||}xjtj�}||kr8Ptj�|kr|tj�|}d||�d|d�d|�d|�d�	}t|��tjd�t�q&WXdS)	aH
    bpo-31234: Context manager to wait until all threads created in the with
    statement exit.

    Use _thread.count() to check if threads exited. Indirectly, wait until
    threads exit the internal t_bootstrap() C function of the _thread module.

    threading_setup() and threading_cleanup() are designed to emit a warning
    if a test leaves running threads in the background. This context manager
    is designed to cleanup threads started by the _thread.start_new_thread()
    which doesn't allow to wait for thread exit, whereas thread.Thread has a
    join() method.
    Nz!wait_threads() failed to cleanup z threads after z.1fz seconds (count: z
, old count: �)g{�G�z�?)rJrKr�Z	monotonicrr�r�)r�Z	old_countZ
start_timeZdeadlinerPZdtrxrdrdre�wait_threads_exit�s
$
rTc
CsZttd�rVd}xFy2tj|tj�\}}|dkr.Ptd|tjd�WqPYqXqWdS)z�Use this function at the end of test_main() whenever sub-processes
    are started.  This will help ensure that no extra children (zombies)
    stick around to hog resources and create problems when looking
    for refleaks.
    �waitpidrrz2Warning -- reap_children() reaped child process %s)r�NrZ)r�r�rU�WNOHANGr�ror�)Zany_processr2ZstatusrdrdrerL�s
ccs*t|�}g}zZy$x|D]}|j�|j|�qWWn*trVtdt|�t|�f��YnXdVWdz�|rt|�tj�}}xltdd�D]^}|d7}x$|D]}|jt	|tj�d��q�Wdd�|D�}|s�Ptr�tdt|�|f�q�WWdd	d�|D�}|�r"t
jtj
�td
t|���XXdS)Nz/Can't start %d threads, only %d threads startedrr�<g{�G�z�?cSsg|]}|j�r|�qSrd)�isAlive)rCr�rdrdrerD�sz!start_threads.<locals>.<listcomp>z7Unable to join %d threads during a period of %d minutescSsg|]}|j�r|�qSrd)rX)rCr�rdrdrerD�szUnable to join %d threads)r|rr�rr�r�r�rOr��max�faulthandlerZdump_tracebackror�r)ZthreadsZunlockrr�ZendtimeZ	starttimer�rdrdrerQ�s>


c
csnt||�r<t||�}t|||�z
|VWdt|||�Xn.t|||�z
dVWdt||�rht||�XdS)a�Temporary swap out an attribute with a new object.

    Usage:
        with swap_attr(obj, "attr", 5):
            ...

        This will set obj.attr to 5 for the duration of the with: block,
        restoring the old value at the end of the block. If `attr` doesn't
        exist on `obj`, it will be created and then deleted at the end of the
        block.

        The old value (or None if it doesn't exist) will be assigned to the
        target of the "as" clause, if there is one.
    N)r�r�r��delattr)r�rl�new_val�real_valrdrdrerW�s




ccsX||kr0||}|||<z
|VWd|||<Xn$|||<z
dVWd||krR||=XdS)a�Temporary swap out an item with a new object.

    Usage:
        with swap_item(obj, "item", 5):
            ...

        This will set obj["item"] to 5 for the duration of the with: block,
        restoring the old value at the end of the block. If `item` doesn't
        exist on `obj`, it will be created and then deleted at the end of the
        block.

        The old value (or None if it doesn't exist) will be assigned to the
        target of the "as" clause, if there is one.
    Nrd)r��itemr\r]rdrdrerV	s

cCstjdd|�j�}|S)z�Strip the stderr of a Python process from potential debug output
    emitted by the interpreter.

    This will typically be run on the result of the communicate() method
    of a subprocess.Popen object.
    s\[\d+ refs, \d+ blocks\]\r?\n?�)rw�sub�strip)r�rdrdre�strip_python_stderr8	srbZ	getcountsz-types are immortal if COUNT_ALLOCS is definedcCstj�S)znReturn a list of command-line arguments reproducing the current
    settings in sys.flags and sys.warnoptions.)rZ_args_from_interpreter_flagsrdrdrdre�args_from_interpreter_flagsE	srccCstj�S)zgReturn a list of command-line arguments reproducing the current
    optimization settings in sys.flags.)rZ"_optim_args_from_interpreter_flagsrdrdrdre�!optim_args_from_interpreter_flagsJ	srdc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rMcCstjjj|d�||_dS)Nr)�logging�handlers�BufferingHandlerri�matcher)rhrhrdrdreriT	szTestHandler.__init__cCsdS)NFrd)rhrdrdre�shouldFlush]	szTestHandler.shouldFlushcCs|j|�|jj|j�dS)N)r�r�r��__dict__)rhrprdrdre�emit`	s
zTestHandler.emitcKs.d}x$|jD]}|jj|f|�rd}PqW|S)zW
        Look for a saved dict whose keys/values match the supplied arguments.
        FT)r�rh�matches)rhr�r��drdrdrerld	szTestHandler.matchesN)r`rarbririrkrlrdrdrdrerMS	s	c@s eZdZdZdd�Zdd�ZdS)	rXrxrvcKs<d}x2|D]*}||}|j|�}|j|||�s
d}Pq
W|S)a.
        Try to match a single dict with the supplied arguments.

        Keys whose values are strings and which are in self._partial_matches
        will be checked for partial (i.e. substring) matches. You can extend
        this scheme to (for example) do regular expression matching, etc.
        TF)r^�match_value)rhrmr�r�r�r��dvrdrdrerls	s

zMatcher.matchescCsHt|�t|�krd}n.t|�tk	s,||jkr6||k}n|j|�dk}|S)zT
        Try to match a single stored value (dv) with a supplied value (v).
        Fr)r�ru�_partial_matches�find)rhr�ror�r�rdrdrern�	s
zMatcher.match_valueN)rxrv)r`rarbrprlrnrdrdrdrerXo	sc
CsZtdk	rtStd}ytjt|�d}Wntttfk
rFd}YnXtj|�|a|S)NrTF)�_can_symlinkrr��symlinkr��NotImplementedErrorr�r{)Zsymlink_path�canrdrdrer�	s

cCs t�}d}|r|Stj|�|�S)z8Skip decorator for tests that require functional symlinkz*Requires functional symlink implementation)rrsr)r��okrxrdrdrer/�	scCs�tdk	rtSttd�sd}n�tj�}tj|d�\}}z�ttd���}y`tj|dd�tj|dd�tj|j	�dd�t
j�}tj
d	|�}|dkp�t|jd
��dk}Wntk
r�d}YnXWdQRXWdtt�t|�t|�X|a|S)N�setxattrF)�dirrGs	user.testr_strusted.foos42z
2.6.(\d{1,2})r�')�
_can_xattrr�r�r,r-Zmkstempr>rrwrHrpr�rwrxr�rr�rr�)ruZtmp_dirZtmp_fpZtmp_name�fpZkernel_versionr�rdrdre�	can_xattr�	s,

r|cCs t�}d}|r|Stj|�|�S)zDSkip decorator for tests that require functional extended attributesz(no non-broken extended attribute support)r|rsr)r�rvrxrdrdrer8�	scCs$tpt}d}|r|Stj|�|�S)z;Skip decorator for tests not run in (non-extended) PGO taskz#Not run for (non-extended) PGO task)r]�PGO_EXTENDEDrsr)r�rvrxrdrdre�skip_if_pgo_task�	s
r~cCs^tj|d��H}|j}|j�}||kr,|j�}ytjj||�Stk
rNdSXWdQRXdS)zKDetects if the file system for the specified directory is case-insensitive.)rxFN)	r,ZNamedTemporaryFilerv�upperrr�r��samefiler�)Z	directory�base�	base_pathZ	case_pathrdrdrer�	s)rfcCs>tt|��tt|��}|r(|t|�8}tdd�|D��}|S)aReturns the set of items in ref_api not in other_api, except for a
    defined list of items to be ignored in this check.

    By default this skips private attributes beginning with '_' but
    includes all magic methods, i.e. those starting and ending in '__'.
    css(|] }|jd�s|jd�r|VqdS)�_�__N)rq�endswith)rCr�rdrdre�	<genexpr>�	sz&detect_api_mismatch.<locals>.<genexpr>)r�rx)Zref_apiZ	other_apirfZ
missing_itemsrdrdrer<�	s
cCs�|dkr|jf}nt|t�r"|f}t|�}xbt|�D]V}|jd�s4||krLq4t||�}t|dd�|ks�t|d�r4t|tj	�r4|j
|�q4W|j|j|�dS)aAssert that the __all__ variable of 'module' contains all public names.

    The module's public names (its API) are detected automatically based on
    whether they match the public name convention and were defined in
    'module'.

    The 'name_of_module' argument can specify (as a string or tuple thereof)
    what module(s) an API could be defined in in order to be detected as a
    public API. One case for this is when 'module' imports part of its public
    API from other modules, possibly a C backend (like 'csv' and its '_csv').

    The 'extra' argument can be a set of names that wouldn't otherwise be
    automatically detected as "public", like objects without a proper
    '__module__' attribute. If provided, it will be added to the
    automatically detected ones.

    The 'blacklist' argument can be a set of names that must not be treated
    as part of the public API even though their names indicate otherwise.

    Usage:
        import bar
        import foo
        import unittest
        from test import support

        class MiscTestCase(unittest.TestCase):
            def test__all__(self):
                support.check__all__(self, foo)

        class OtherTestCase(unittest.TestCase):
            def test__all__(self):
                extra = {'BAR_CONST', 'FOO_CONST'}
                blacklist = {'baz'}  # Undocumented name.
                # bar imports part of its API from _bar.
                support.check__all__(self, bar, ('bar', '_bar'),
                                     extra=extra, blacklist=blacklist)

    Nr�ra)
r`r�rur�rxrqr�r��types�
ModuleType�addZassertCountEqual�__all__)Z	test_caser�Zname_of_moduleZextraZ	blacklistZexpectedrvr�rdrdrer=�	s)


c@s(eZdZdZdZdZdd�Zdd�ZdS)rZz�Try to prevent a crash report from popping up.

    On Windows, don't display the Windows Error Reporting dialog.  On UNIX,
    disable the creation of coredump file.
    Nc
Csrtjjd�r�ddl}|jj|_d}|jj|�|_|jj|j|B�yddl	}|j
Wnttfk
rlYnLXi|_
x�|j|j|jgD].}|j
||j�}|j||j�}||f|j
|<q�Wn�tdk	�r
y*tjtj�|_tjtjd|jdf�Wnttfk
�rYnXtjdk�rnddd	d
g}tj|tjtjd�}|�|j�d}	WdQRX|	j�dk�rntd
ddd�|S)z�On Windows, disable Windows Error Reporting dialogs using
        SetErrorMode.

        On UNIX, try to save the previous core file size limit, then set
        soft limit to 0.
        r�rNr�rr�z/usr/bin/defaultsr_zcom.apple.CrashReporterZ
DialogType)r�r�s	developerz:this test triggers the Crash Reporter, that is intentionalr�T)�endr
) rorprqr�r�r��_k32�SetErrorMode�	old_value�msvcrt�CrtSetReportModer�rn�	old_modes�CRT_WARN�	CRT_ERROR�
CRT_ASSERTZCRTDBG_MODE_FILE�CrtSetReportFileZCRTDBG_FILE_STDERRr�Z	getrlimit�RLIMIT_CORE�	setrlimitr�r�rr�PIPEZcommunicaterar�)
rhr�ZSEM_NOGPFAULTERRORBOXr��report_type�old_mode�old_file�cmd�procr�rdrdrer�2
sN




zSuppressCrashReport.__enter__cGs�|jdkrdStjjd�rl|jj|j�|jr�ddl}xj|jj�D]$\}\}}|j	||�|j
||�qBWn6tdk	r�ytjtj
|j�Wnttfk
r�YnXdS)zARestore Windows ErrorMode or core file behavior to initial value.Nr�r)r�rorprqr�r�r�r�r�r�r�r�r�r�r�r�)rhr�r�r�r�r�rdrdrer�s
s
zSuppressCrashReport.__exit__)r`rarbrcr�r�r�r�rdrdrdrerZ)
s
Acsrt���d�y�j��Wn$ttfk
r@t��d��YnXd�����fdd�}|j|�t��|�dS)z�Override 'object_to_patch'.'attr_name' with 'new_value'.

    Also, add a cleanup procedure to 'test_instance' to restore
    'object_to_patch' value for 'attr_name'.
    The 'attr_name' should be a valid attribute for 'object_to_patch'.

    FNTcs �rt����n
t���dS)N)r�r[rd)�
attr_is_local�	attr_name�object_to_patchr�rdre�cleanup�
szpatch.<locals>.cleanup)r�rjr�r�Z
addCleanupr�)Z
test_instancer�r�Z	new_valuer�rd)r�r�r�r�re�patch�
s


r�cCsFyddl}Wntk
r YnX|j�r4tjd��ddl}|j|�S)zi
    Run code in a subinterpreter. Raise unittest.SkipTest if the tracemalloc
    module is enabled.
    rNzUrun_in_subinterp() cannot be used if tracemalloc module is tracing memory allocations)�tracemallocrnZ
is_tracingrsrtr��run_in_subinterp)r�r�r�rdrdrer��
s
r�csHG��fdd�d|�}d�|||���|jtt��t�|j��dS)NcseZdZ��fdd�ZdS)z%check_free_after_iterating.<locals>.Acs*d�yt��Wntk
r$YnXdS)NT)�next�
StopIteration)rh)�done�itrdre�__del__�
s
z-check_free_after_iterating.<locals>.A.__del__N)r`rarbr�rd)r�r�rdre�A�
sr�F)rMr�r�r�Z
assertTrue)r�r�rCr�r�rd)r�r�re�check_free_after_iterating�
s	r�cCs�ddlm}m}m}|j�}|j|�xd|jD]Z}|r@||kr@q.t||�}|rd|dk	sntd|��n
|dkrnq.|j	|d�dkr.|dSq.WdS)a<Check if the compiler components used to build the interpreter exist.

    Check for the existence of the compiler executables whose names are listed
    in 'cmd_names' or all the compiler executables when 'cmd_names' is empty
    and return the first missing executable or None when none is found
    missing.

    r)�	ccompilerr��spawnNz%the '%s' executable is not configured)
Z	distutilsr�r�r�Znew_compilerZcustomize_compilerZexecutablesr�rZfind_executable)Z	cmd_namesr�r�r�Zcompilerrvr�rdrdrer^�
s	


cCs@d}tr6||kr6tdkr.tjddg�j�dkatr6|}tj|�S)Ng�h㈵��>Zgetpropzro.kernel.qemu�1)rA�_is_android_emulatorrZcheck_outputrarorD)ZintervalZminimum_intervalrdrdrerD�
sc
cs>tjj�}tj�}ztj�dVWd|r8tj|dd�XdS)NT)r�Zall_threads)ror�rHrZ�
is_enabledr�r�)rBr�rdrdre�disable_faulthandler�
s

r�c	/Cs�tjjd�r8ytjd�}t|�dStk
r6YnXd}ttd�rjytjd�}Wnt	k
rhYnXd}tjd	kr�yd
dl
}|jWntt
fk
r�Yn0Xi}x(|j|j|jfD]}|j|d
�||<q�Wzpd
}xft|�D]Z}ytj|�}Wn4t	k
�r(}z|jtjk�r�WYdd}~Xq�Xtj|�|d7}q�WWd|dk	�rzx*|j|j|jfD]}|j|||��q`WX|S)z/Count the number of open file descriptors.
    �linux�freebsdz
/proc/self/fdr��sysconf�SC_OPEN_MAXNrr)r�r�)rorprqr�r�r�r�r�r�r�r�r�r�rnr�r�r�rO�dupr�ZEBADFr)	�namesZMAXFDr�r�r�rPrBZfd2r�rdrdrer_	sP





c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�SaveSignalsz�
    Save an restore signal handlers.

    This class is only able to save/restore signal handlers registered
    by the Python signal module: see bpo-13285 for "external" signal
    handlers.
    cCsjddl}||_ttd|j��|_x>dD]6}yt||�}Wntk
rNw&YnX|jj|�q&Wi|_dS)Nrr�SIGKILL�SIGSTOP)r�r�)	�signalr|rO�NSIG�signalsr�r�r{rf)rhr�Zsigname�signumrdrdreriMs
zSaveSignals.__init__cCs4x.|jD]$}|jj|�}|dkr"q||j|<qWdS)N)r�r��	getsignalrf)rhr��handlerrdrdre�saveZs
zSaveSignals.savecCs*x$|jj�D]\}}|jj||�qWdS)N)rfr�r�)rhr�r�rdrdre�restorefszSaveSignals.restoreN)r`rarbrcrir�r�rdrdrdrer�Ds
r�c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�FakePathz.Simple implementing of the path protocol.
    cCs
||_dS)N)r�)rhr�rdrdrerinszFakePath.__init__cCsd|j�d�S)Nz
<FakePath �>)r�)rhrdrdre�__repr__qszFakePath.__repr__cCs6t|jt�s$t|jt�r,t|jt�r,|j�n|jSdS)N)r�r��
BaseExceptionr�rz)rhrdrdre�
__fspath__ts
zFakePath.__fspath__N)r`rarbrcrir�r�rdrdrdrer�ksr�ccs.tj�}ztj|�dVWdtj|�XdS)z>Temporarily change the integer string conversion length limit.N)ro�get_int_max_str_digits�set_int_max_str_digits)Z
max_digitsZcurrentrdrdre�adjust_int_max_str_digits|s


r�)T)F)F)N)Nii@i@i@ii)rrrrrrrr r!r"r#)r'r%r(r)r*)NF)F)r7F)N)Fi@ii)T)N)Nr)rR)N(rcr`rn�collections.abc�collections�
contextlibZdatetimer�rZr?r�r�r�rm�importlib.utilr�Zlogging.handlersrer�r�rprwr�rr�r�rror�r,r�r�rsZurllib.errorrargZ
testresultrrJrLZmultiprocessing.processr&�zlibrX�bz2Zlzmar�r�r�r�r	r
rrtr�contextmanagerrkr
rr�r:r;rr6rrrrr0rr�rrrr�rqr�r�r�r�r�rr�rr�rr�r r!r�r"r#r$r%rErr	r
rGrHrJrrFrrZ
SOCK_MAX_SIZEZ
skipUnlessr�
__getformat__r7r9r0r1r2r@r�rrArCrvrr�r0ZFS_NONASCII�	character�fsdecode�fsencode�UnicodeErrorZTESTFN_UNICODEZunicodedataZ	normalize�getfilesystemencodingZTESTFN_ENCODINGZTESTFN_UNENCODABLEZgetwindowsversion�encode�UnicodeEncodeErrorr��decode�UnicodeDecodeErrorZTESTFN_UNDECODABLEZTESTFN_NONASCIIr4rr]r}r3r6rr�rKr�r�r�r�ZTEST_SUPPORT_DIRr;r�r]rrr[rIr&rI�objectrer�rRr�r�rSr�abc�MutableMappingrTr�r'r�r�r(r�r)r*r+r�rrrr�r�r�r�r�r�r�r�r�r�r�rUr\r�r�rZ_4GrrrYr	r3r4r,rrr>r5r!r%r?r"rBr*r+r-r2r3r<r5r7rAr-rDZMISSING_C_DOCSTRINGSZHAVE_DOCSTRINGSZrequires_docstringsr.rHrIZenvironment_alteredrNrOrPrTrLrQrWrVrbZskipIfZrequires_type_collectingrcrdrfrgrMrXrrrr/rzr|r8r~rr<r=rZr�r�r�r^r�rDr�r_r�r�r�rdrdrdre�<module>s�











2	
!

J			>%	


%2' 5M		



$
#
0







(




"
#
	"
:_";'support/__pycache__/testresult.cpython-36.opt-1.pyc000064400000017130150327172730016304 0ustar003


 \
�@s6dZddlZddlZddlZddlZddlZddlZddljj	Z
ddlmZGdd�dej�Z
Gdd�d�Zdd	d
�Zddd�Zed
k�r2Gdd�dej�Zej�Zejeje��ej�Zeedd�ejD���Zeej�Zeje�Z e!dej"��e!ddd�x(e
j#e j$��D]Z%e!e%j&�dd��qWe!�dS)z=Test runner and result class for the regression test suite.

�N)�datetimecs�eZdZdddZdddZ�fdd�Zedd��Z�fd	d
�Zd$dd
�Z	dd�Z
edd��Z�fdd�Z�fdd�Z
�fdd�Z�fdd�Z�fdd�Z�fdd�Zdd�Zd d!�Zd"d#�Z�ZS)%�RegressionTestResult�=�F�
�-cs\t�j||dd�d|_tjd�|_|jjdtj�j	d��d|_
d|_g|_t
|�|_dS)Nr)�stream�descriptions�	verbosityTZ	testsuite�start� )�super�__init__�buffer�ETZElement�_RegressionTestResult__suite�setrZutcnowZ	isoformat�_RegressionTestResult__e�!_RegressionTestResult__start_timeZ_RegressionTestResult__results�bool�_RegressionTestResult__verbose)�selfrr	r
)�	__class__��//usr/lib64/python3.6/test/support/testresult.pyrszRegressionTestResult.__init__cCsLy
|j}Wntk
r"t|�SXy|�Stk
rBt|�SXt|�S)N)�id�AttributeError�str�	TypeError�repr)�cls�testZtest_idrrrZ__getIds


zRegressionTestResult.__getIdcsVt�j|�tj|jd�|_}tj�|_|j	rR|j
j|j|��d��|j
j
�dS)NZtestcasez ... )r
�	startTestr�
SubElementrr�time�perf_counterrrr�write�getDescription�flush)rr!�e)rrrr"+s
zRegressionTestResult.startTestFcKsP|j}d|_|dkrdS|jd|jd|j|���|jd|jdd��|jd|jdd��|jrz|jdtj�|jd��|r�|jdk	r�|jj�j	�}|t
j|d�_|j
dk	r�|j
j�j	�}|t
j|d	�_x�|j�D]t\}}|s�|r�q�t
j||�}	t|d
��r>xD|j�D],\}
}|
�r,|	j|
t|��n
t|�|	_�qWq�t|�|	_q�WdS)N�nameZstatus�run�resultZ	completedr$z0.6fz
system-outz
system-err�items)rr�pop�_RegressionTestResult__getIdrr$r%Z_stdout_buffer�getvalue�rstriprr#�textZ_stderr_bufferr-�hasattrr)rr!Zcapture�argsr)�stdout�stderr�k�vZe2Zk2Zv2rrr�_add_result3s4

z RegressionTestResult._add_resultcCs|jr|jj|�d��dS)Nr)rrr&)r�cZwordrrrZ__writeSszRegressionTestResult.__writecCslt|t�r0|jdkr|j}q8|j�d|j��}nt|�}tj||d�}tj|||�}|dj|�dj|�d�S)N�builtins�.�)�type�messager=)�
isinstancer>�
__module__�__name__r�	traceback�format_exception�join)r Zerr_typeZ	err_valueZerr_tb�typename�msg�tbrrrZ__makeErrorDictWs

z$RegressionTestResult.__makeErrorDictcs4|j|d|j|�d�t�j||�|jdd�dS)NT)�error�E�ERROR)r9�$_RegressionTestResult__makeErrorDictr
�addError�_RegressionTestResult__write)rr!�err)rrrrMjszRegressionTestResult.addErrorcs4|j|d|j|�d�t�j||�|jdd�dS)NT)�output�xzexpected failure)r9rLr
�addExpectedFailurerN)rr!rO)rrrrRosz'RegressionTestResult.addExpectedFailurecs4|j|d|j|�d�t�j||�|jdd�dS)NT)Zfailure�F�FAIL)r9rLr
�
addFailurerN)rr!rO)rrrrUtszRegressionTestResult.addFailurecs2|j||d�t�j||�|jdd|���dS)N)Zskipped�Szskipped )r9r
�addSkiprN)rr!�reason)rrrrWyszRegressionTestResult.addSkipcs&|j|�t�j|�|jdd�dS)Nr<�ok)r9r
�
addSuccessrN)rr!)rrrrZ~s
zRegressionTestResult.addSuccesscs*|j|dd�t�j|�|jdd�dS)NZUNEXPECTED_SUCCESS)Zoutcome�uzunexpected success)r9r
�addUnexpectedSuccessrN)rr!)rrrr\�sz)RegressionTestResult.addUnexpectedSuccesscCs2|jr|jjd�|jd|j�|jd|j�dS)NrrKrT)rrr&�printErrorList�errors�failures)rrrr�printErrors�sz RegressionTestResult.printErrorscCs`xZ|D]R\}}|jj|j�|jj|�d|j|��d��|jj|j�|jjd|�qWdS)Nz: rz%s
)rr&�
separator1r'�
separator2)rZflavorr^r!rOrrrr]�s
z#RegressionTestResult.printErrorListcCsH|j}|jdt|j��|jdtt|j���|jdtt|j���|S)NZtestsr^r_)rrrZtestsRun�lenr^r_)rr)rrr�get_xml_element�s
z$RegressionTestResult.get_xml_element)F)rBrA�__qualname__rarbr�classmethodr/r"r9rNrLrMrRrUrWrZr\r`r]rd�
__classcell__rr)rrrs"
 rc@seZdZddd�Zdd�ZdS)�QuietRegressionTestRunnerFcCst|dd�|_||j_dS)Nr)rr,r)rrrrrrr�sz"QuietRegressionTestRunner.__init__cCs||j�|jS)N)r,)rr!rrrr+�s
zQuietRegressionTestRunner.runN)F)rBrArerr+rrrrrh�s
rhFcCs&|rtjtjt||d�Stjt|d�S)N)Zresultclassrr
)r)�	functools�partial�unittestZTextTestRunnerrrh)r
rrrr�get_test_runner_class�srlcCst||�|�S)N)rl)rr
Zcapture_outputrrr�get_test_runner�srm�__main__c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�	TestTestscCsdS)Nr)rrrr�	test_pass�szTestTests.test_passcCstjd�dS)Ng�?)r$Zsleep)rrrr�test_pass_slow�szTestTests.test_pass_slowcCs*tdtjd�tdtjd�|jd�dS)Nr5)�filer6zfailure message)�print�sysr5r6Zfail)rrrr�	test_fail�szTestTests.test_failcCs(tdtjd�tdtjd�td��dS)Nr5)rrr6z
error message)rsrtr5r6�RuntimeError)rrrr�
test_error�szTestTests.test_errorN)rBrArerprqrurwrrrrro�sroccs|]}|dkVqdS)z-vNr)�.0�arrr�	<genexpr>�srzzOutput:zXML: r=)�end)F)F)'�__doc__ri�iortr$rCrkZxml.etree.ElementTreeZetreeZElementTreerrZTextTestResultrrhrlrmrBZTestCaseroZ	TestSuiteZsuiteZaddTestZ	makeSuite�StringIOr�sum�argvZ
runner_clsr5Zrunnerr+r,rsr0Ztostringlistrd�s�decoderrrr�<module>s4
	




support/__pycache__/__init__.cpython-36.opt-1.pyc000064400000236455150327172730015642 0ustar003

�\dh����@s^
dZedkred��ddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZ
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl!Z"ddl#Z#ddl$m%Z%yddl&Z&ddl'Z'Wnek
�rBdZ&dZ'YnXyddl(Z)Wnek
�rjdZ)YnXyddl*Z*Wnek
�r�dZ*YnXyddl+Z+Wnek
�r�dZ+YnXyddl,Z,Wnek
�r�dZ,YnXyddl-Z-Wnek
�r
dZ-YnXyddl.Z.Wnek
�r2dZ.YnXyddl/Z/Wnek
�rZdZ/YnXddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbg\Z0Gdcd�de1�Z2Gddd
�d
e2�Z3Gded�de2�Z4Gdfd�de j5�Z6ej7�dfdhdi��Z8�dgfdk�dld�Z9dmdn�Z:dodp�Z;dqd=�Z<drd>�Z=ffdjfdsd�Z>dtd9�Z?dZ@dZAdaBdaCdZDdjZEdaFdud�ZGdvd�ZHdwd�ZIdxdy�ZJejjKdz��r.�dhd{d|�ZLd}d~�ZMdd��ZNd�d��ZOd�d��ZPnejQZMejRZNd�d��ZOd�d��ZPd�d�ZQd�d��ZRd�d�ZSd�d��ZTd�d�ZUd�d��ZVd�d#�ZW�did�d$�ZXd�d��ZYd�d%�ZZd�d&�Z[d�d'�Z\�djd�d(�Z]d�Z^d�Z_ej`ejafd�dJ�Zbe^fd�dK�Zcd�dM�Zdd�d��Zeee�Zfd�d��Zg�dmZh�dpZie jjekjld��jKd��d��Zme jje*d��Zne jje+d��Zoe jje,d��Zpe jje-d��ZqejjKd��Zrejsd��Ztetdk	�oxetdkZuejd�k�r�eu�r�d�nd�ZvndZvejwd�k�r�d�Zxnd�Zxd�jyexejz��ZxdZ{xL�dqD]BZ|yej}ej~e|��e|k�r�e�Wnek
�rYnXe|Z{P�q�Wexd�Z�ejd�k�r:ddl�Z�e�j�d�e��Z�ej��Z�dZ�ejwd�k�r�ej��jd�k�r�exd�Z�ye�j�e��Wne�k
�r�YnXe�d�e�e�f�dZ�nBejd�k�r�yd�j�e��Wn&e�k
�r�exd�j�e�dǃZ�YnXdZ�xF�drD]<Zwyewj�e��Wn&e�k
�r,ej~ex�ewZ�PYnX�q�We{�rHexd�e{Z�ndZ�ej��Z�djZ�djZ�ej7�dsd�d΄�Z�ej7�dtd�dЄ�Z�ej7�dud�d��Z�e�edӃ�r�ej7d�dN��Z�ej�j�ej�j�e���Z�ej�j�e��Z�ej�j�e�dՃZ��dvd�d�Z�d�d �Z�d�d^�Z�d�dڄZ�dddۜd�d)�Z�d�dL�Z�Gd�d߄d�e��Z��dwd�d�Z�ej7d�dU��Z�ej7d�e�djfd�d��Z�ej7d�dV��Z�Gd�d�de��Z�Gd�dW�dWej�j��Z�Gd�d�d�e��Z�Gd�d*�d*e��Z�e�e�ej�d�Z�e�e�ej�d�Z�e�e�ej�d�Z�ej7d�fd�d�d.��Z�ej7d�d��Z�d�d�Z�d�d�Z�d�d�Z�d�d��Z�ej7d�d���Z�d�d��Z�d�Z�d�Z�e�ed���	rLd�e�Z�d�Z�e��dZd�d�ZÐd�d�ZĐdxZŐdyZƐd�d�Zǐd	dX�ZȐd
d_�ZɐdzZ�d�e�Z�d�e�Z�d�e�Z�ej�Zϐdd\�Z�G�d�d
��d
�Zѐd{�dd6�ZҐdd7�Z�G�dd/�d/�ZԐd�d�ZՐd�d�Z֐ddA�Zאdd8�Zؐd|�d�d�Z�daڐddB�Zېd�d�ZܐddE�Zݐd�d�Zސd�d �Zߐd!�d"�Z�d#�d$�Z�da�da�d%�d&�Z�d'�d(�Z�d)�d*�Z�d+d0�Z�d,�d-�Z�e݃�
o�ejd�k�
o�ejs�d.�Z�e�jdk	�oe�Z�e jje�d/�Z�d}�d0d1�Z�d1�d2�Z�d3�d4�Z�djZ�d5dQ�Z�d6dR�Z�d7dS�Z�ej7�d~�d9�d:��Z�d;dO�Z�ej7�d�d<dT��Z�ej7�d=dZ��Z�ej7�d>dY��Z��d?�d@�Z�e j�e�e�dA��dB�Z��dC�dD�Z��dE�dF�Z�G�dGdP�dPej�j��Z�G�dHd[�d[e���Zd�a�dId!��Z�dJd2��Zd�a�dK�dL��Z�dMd;��Z�dN�dO��Z�dPd"��Zf�dQ��dRd?��Z	dfff�dSd@��Z
G�dTd]�d]��Z�dU�dV��Z�dW�dX��Z
ff�dY�dZ��Zgf�d[da��Zd�a�d\dG��Zej7�d]�d^���Z�d_db��ZG�d`�da��da��ZG�db�dc��dc��Zej7�dd�de���ZdS(�z7Supporting definitions for the Python regression tests.ztest.supportz.support must be imported from the test package�N�)�get_test_runner�
PIPE_MAX_SIZE�verbose�
max_memuse�
use_resources�failfast�Error�
TestFailed�
TestDidNotRun�ResourceDenied�
import_module�import_fresh_module�CleanImport�unload�forget�record_original_stdout�get_original_stdout�captured_stdout�captured_stdin�captured_stderr�TESTFN�SAVEDCWD�unlink�rmtree�temp_cwd�findfile�create_empty_file�can_symlink�fs_is_case_insensitive�is_resource_enabled�requires�requires_freebsd_version�requires_linux_version�requires_mac_ver�requires_hashdigest�check_syntax_error�TransientResource�time_out�socket_peer_reset�ioerror_peer_reset�transient_internet�BasicTestRunner�run_unittest�run_doctest�skip_unless_symlink�
requires_gzip�requires_bz2�
requires_lzma�
bigmemtest�bigaddrspacetest�cpython_only�
get_attribute�requires_IEEE_754�skip_unless_xattr�
requires_zlib�anticipate_failure�load_package_tests�detect_api_mismatch�check__all__�requires_android_level�requires_multiprocessing_queue�	is_jython�
is_android�check_impl_detail�
unix_shell�setswitchinterval�HOST�IPV6_ENABLED�find_unused_port�	bind_port�open_urlresource�bind_unix_socket�
temp_umask�
reap_children�TestHandler�threading_setup�threading_cleanup�reap_threads�
start_threads�check_warnings�check_no_resource_warning�EnvironmentVarGuard�run_with_locale�	swap_item�	swap_attr�Matcher�set_memlimit�SuppressCrashReport�sortdict�run_with_tz�PGO�missing_compiler_executable�fd_countc@seZdZdZdS)r	z*Base class for regression test exceptions.N)�__name__�
__module__�__qualname__�__doc__�rdrd�-/usr/lib64/python3.6/test/support/__init__.pyr	|sc@seZdZdZdS)r
zTest failed.N)r`rarbrcrdrdrdrer
sc@seZdZdZdS)rzTest did not run any subtests.N)r`rarbrcrdrdrdrer�sc@seZdZdZdS)rz�Test skipped because it requested a disallowed resource.

    This is raised when a test calls requires() for a resource that
    has not be enabled.  It is used to distinguish between expected
    and unexpected skips.
    N)r`rarbrcrdrdrdrer�sTccs8|r.tj��tjddt�dVWdQRXndVdS)z�Context manager to suppress package and module deprecation
    warnings when importing them.

    If ignore is False, this context manager has no effect.
    �ignorez.+ (module|package)N)�warnings�catch_warnings�filterwarnings�DeprecationWarning)rfrdrdre�_ignore_deprecated_imports�s
rkF)�required_oncCsft|��Ty
tj|�Stk
rV}z&tjjt|��r8�tj	t
|���WYdd}~XnXWdQRXdS)acImport and return the module to be tested, raising SkipTest if
    it is not available.

    If deprecated is True, any module or package deprecation messages
    will be suppressed. If a module is required on a platform but optional for
    others, set required_on to an iterable of platform prefixes which will be
    compared against sys.platform.
    N)rk�	importlibr
�ImportError�sys�platform�
startswith�tuple�unittest�SkipTest�str)�name�
deprecatedrl�msgrdrdrer
�s	

cCs^|tjkrt|�tj|=x>ttj�D]0}||ks@|j|d�r&tj|||<tj|=q&WdS)zyHelper function to save and remove a module from sys.modules

    Raise ImportError if the module can't be imported.
    �.N)ro�modules�
__import__�listrq)rv�orig_modules�modnamerdrdre�_save_and_remove_module�s
rcCs>d}ytj|||<Wntk
r.d}YnXdtj|<|S)z�Helper function to save and block a module in sys.modules

    Return True if the module was in sys.modules, False otherwise.
    TFN)rorz�KeyError)rvr}Zsavedrdrdre�_save_and_block_module�s

r�cCs|r
tjSdd�S)z�Decorator to mark a test that is known to be broken in some cases

       Any use of this decorator should have a comment identifying the
       associated tracker issue.
    cSs|S)Nrd)�frdrdre�<lambda>�sz$anticipate_failure.<locals>.<lambda>)rsZexpectedFailure)Z	conditionrdrdrer:�scCsF|dkrd}tjjtjjtjjt���}|j|||d�}|j|�|S)z�Generic load_tests implementation for simple test packages.

    Most packages can implement load_tests using this function as follows:

       def load_tests(*args):
           return load_package_tests(os.path.dirname(__file__), *args)
    Nztest*)Z	start_dirZ
top_level_dir�pattern)�os�path�dirname�__file__ZdiscoverZaddTests)Zpkg_dir�loaderZstandard_testsr�Ztop_dirZ
package_testsrdrdrer;�s
cCs�t|���i}g}t||�zfyHx|D]}t||�q&Wx |D]}t||�s>|j|�q>Wtj|�}Wntk
r~d}YnXWdx|j�D]\}	}
|
tj	|	<q�Wx|D]}tj	|=q�WX|SQRXdS)a�Import and return a module, deliberately bypassing sys.modules.

    This function imports and returns a fresh copy of the named Python module
    by removing the named module from sys.modules before doing the import.
    Note that unlike reload, the original module is not affected by
    this operation.

    *fresh* is an iterable of additional module names that are also removed
    from the sys.modules cache before doing the import.

    *blocked* is an iterable of module names that are replaced with None
    in the module cache during the import to ensure that attempts to import
    them raise ImportError.

    The named module and any modules named in the *fresh* and *blocked*
    parameters are saved before starting the import and then reinserted into
    sys.modules when the fresh import is complete.

    Module and package deprecation messages are suppressed during this import
    if *deprecated* is True.

    This function will raise ImportError if the named module cannot be
    imported.
    N)
rkrr��appendrmr
rn�itemsrorz)rvZfreshZblockedrwr}Znames_to_removeZ
fresh_nameZblocked_nameZfresh_moduleZ	orig_name�moduleZname_to_removerdrdrer�s$





cCs>yt||�}Wn&tk
r4tjd||f��YnX|SdS)z?Get an attribute, raising SkipTest if AttributeError is raised.zobject %r has no attribute %rN)�getattr�AttributeErrorrsrt)�objrvZ	attributerdrdrer6s
cCs|adS)N)�_original_stdout)�stdoutrdrdrer0scCs
tptjS)N)r�ror�rdrdrdrer4scCs&ytj|=Wntk
r YnXdS)N)rorzr�)rvrdrdrer7scGsny||�Stk
rh}zDtdkrHtd|jj|f�td|j|f�tj|tj�||�Sd}~XnXdS)N�z%s: %szre-run %s%r)	�OSErrorr�print�	__class__r`r��chmod�stat�S_IRWXU)r��func�args�errrdrdre�
_force_run=sr��wincCs�||�|r|}ntjj|�\}}|p(d}d}x<|dkrjtj|�}|rJ|n||ksVdStj|�|d9}q0Wtjd|tdd�dS)Nryg����MbP?g�?r�z)tests may fail, delete still pending for �)�
stacklevel)	r�r��split�listdir�time�sleeprg�warn�RuntimeWarning)r��pathname�waitallr�rv�timeout�Lrdrdre�_waitforHs



r�cCsttj|�dS)N)r�r�r)�filenamerdrdre�_unlinkisr�cCsttj|�dS)N)r�r��rmdir)r�rdrdre�_rmdirlsr�cs,�fdd��t�|dd�tdd�|�dS)Ncs�x�t|tj|�D]�}tjj||�}ytj|�j}Wn<tk
rn}z td||ft	j
d�d}WYdd}~XnXtj|�r�t
�|dd�t|tj|�qt|tj|�qWdS)Nz-support.rmtree(): os.lstat(%r) failed with %s)�filerT)r�)r�r�r�r��join�lstat�st_moder�r�ro�
__stderr__r��S_ISDIRr�r�r)r�rv�fullname�mode�exc)�
_rmtree_innerrdrer�ps

z_rmtree.<locals>._rmtree_innerT)r�cSst|tj|�S)N)r�r�r�)�prdrdrer�sz_rmtree.<locals>.<lambda>)r�)r�rd)r�re�_rmtreeosr�c
Cs^yddl}Wntk
r Yn:X|jt|�d�}|jjj||t|��}|rZ|d|�S|S)Nrr�)�ctypesrnZcreate_unicode_buffer�len�windll�kernel32ZGetLongPathNameW)r�r��bufferZlengthrdrdre�	_longpath�s
r�csFytj|�dStk
r"YnX�fdd���|�tj|�dS)Nc
s�x~t|tj|�D]l}tjj||�}ytj|�j}Wntk
rJd}YnXtj	|�rn�|�t|tj
|�qt|tj|�qWdS)Nr)r�r�r�r�r�r�r�r�r�r�r�r)r�rvr�r�)r�rdrer��s

z_rmtree.<locals>._rmtree_inner)�shutilrr�r�r�)r�rd)r�rer��s
cCs|S)Nrd)r�rdrdrer��scCs*yt|�Wnttfk
r$YnXdS)N)r��FileNotFoundError�NotADirectoryError)r�rdrdrer�scCs&yt|�Wntk
r YnXdS)N)r�r�)r�rdrdrer��sr�cCs&yt|�Wntk
r YnXdS)N)r�r�)r�rdrdrer�scCsBtjj|�}tjjtjj|��}tjj||d�}tj||�|S)aMove a PEP 3147/488 pyc file to its legacy pyc location.

    :param source: The file system path to the source file.  The source file
        does not need to exist, however the PEP 3147/488 pyc file must exist.
    :return: The file system path to the legacy pyc file.
    �c)	rm�util�cache_from_sourcer�r�r��abspathr��rename)�sourceZpyc_fileZup_oneZ
legacy_pycrdrdre�make_legacy_pyc�s
r�cCs\t|�xNtjD]D}tjj||d�}t|d�x dD]}ttjj||d��q8WqWdS)	z�'Forget' a module was ever imported.

    This removes the module from sys.modules and deletes any PEP 3147/488 or
    legacy .pyc files.
    z.pyr��rr�)�optimizationN)r�rr�)	rror�r�r�rrmr�r�)r~r�r��optrdrdrer�s
cs�ttd�rtjSd}tjjd�r�ddl�ddl�d}d}G�fdd�d�j�}�j	j
}|j�}|sj�j��|�}�j
j�}|j||�j|��j|��j|��}|s��j��t|j|@�s�d}n�tjdk�rVdd	lm}	m�m}
m}dd
lm}|	j|d��}
|
j�dk�rd}nFG�fd
d�d|�}|�}|
|�}|
j|�dk�sR|
j|�dk�rVd}|�s�y.ddlm}|�}|j�|j �|j!�Wn\t"k
�r�}z>t#|�}t$|�dk�r�|dd�d}dj%t&|�j'|�}WYdd}~XnX|t_(|t_tjS)N�resultr�rrcs.eZdZd�jjfd�jjfd�jjfgZdS)z*_is_gui_available.<locals>.USEROBJECTFLAGSZfInheritZ	fReserved�dwFlagsN)r`rarb�wintypesZBOOL�DWORD�_fields_rd)r�rdre�USEROBJECTFLAGS�s

r�z,gui not available (WSF_VISIBLE flag not set)�darwin)�cdll�c_int�pointer�	Structure)�find_libraryZApplicationServicesz0gui tests cannot run without OS X window managercseZdZd�fd�fgZdS)z._is_gui_available.<locals>.ProcessSerialNumberZ
highLongOfPSNZlowLongOfPSNN)r`rarbr�rd)r�rdre�ProcessSerialNumbersr�z#cannot run without OS X gui process)�Tk�2z [...]zTk unavailable due to {}: {}))�hasattr�_is_gui_availabler�rorprqr�Zctypes.wintypesr�r�Zuser32ZGetProcessWindowStationZWinErrorr�r�ZGetUserObjectInformationWZbyrefZsizeof�boolr�r�r�r�Zctypes.utilr�ZLoadLibraryZCGMainDisplayIDZGetCurrentProcessZSetFrontProcessZtkinterr�Zwithdraw�updateZdestroy�	Exceptionrur��format�typer`�reason)r�Z	UOI_FLAGSZWSF_VISIBLEr�Zdll�hZuofZneeded�resr�r�r�r�Zapp_servicesr�ZpsnZpsn_pr��root�eZ
err_stringrd)r�r�rer��sh

r�cCstdkp|tkS)z�Test whether a resource is enabled.

    Known resources are set by regrtest.py.  If not running under regrtest.py,
    all resources are assumed enabled unless use_resources has been set.
    N)r)�resourcerdrdrer $scCs>t|�s |dkrd|}t|��|dkr:t�r:ttj��dS)z@Raise ResourceDenied if the specified resource is not available.Nz"Use of the %r resource not enabled�gui)r rr�r�)r�rxrdrdrer!,scs��fdd�}|S)z�Decorator raising SkipTest if the OS is `sysname` and the version is less
    than `min_version`.

    For example, @_requires_unix_version('FreeBSD', (7, 2)) raises SkipTest if
    the FreeBSD version is less than 7.2.
    cs$tj�����fdd��}�|_|S)Nc
s�tj��krztj�jdd�d}yttt|jd���}Wntk
rLYn.X|�krzdjtt	���}t
jd�||f���||�S)N�-rrryz(%s version %s or higher required, not %s)rp�system�releaser�rr�map�int�
ValueErrorr�rursrt)r��kw�version_txt�version�min_version_txt)r��min_version�sysnamerdre�wrapper=sz:_requires_unix_version.<locals>.decorator.<locals>.wrapper)�	functools�wrapsr�)r�r�)r�r�)r�re�	decorator<sz)_requires_unix_version.<locals>.decoratorrd)r�r�r�rd)r�r�re�_requires_unix_version5sr�cGs
td|�S)z�Decorator raising SkipTest if the OS is FreeBSD and the FreeBSD version is
    less than `min_version`.

    For example, @requires_freebsd_version(7, 2) raises SkipTest if the FreeBSD
    version is less than 7.2.
    ZFreeBSD)r�)r�rdrdrer"PscGs
td|�S)z�Decorator raising SkipTest if the OS is Linux and the Linux version is
    less than `min_version`.

    For example, @requires_linux_version(2, 6, 32) raises SkipTest if the Linux
    version is less than 2.6.32.
    ZLinux)r�)r�rdrdrer#Yscs�fdd�}|S)z�Decorator raising SkipTest if the OS is Mac OS X and the OS X
    version if less than min_version.

    For example, @requires_mac_ver(10, 5) raises SkipTest if the OS X version
    is lesser than 10.5.
    cs"tj����fdd��}�|_|S)Ncsxtjdkrntj�d}yttt|jd���}Wntk
rBYn,X|�krndjtt	���}t
jd||f���||�S)Nr�rryz&Mac OS X %s or higher required, not %s)rorpZmac_verrrr�r�r�r�r�rursrt)r�r�r�r�r�)r�r�rdrer�js
z4requires_mac_ver.<locals>.decorator.<locals>.wrapper)r�r�r�)r�r�)r�)r�rer�isz#requires_mac_ver.<locals>.decoratorrd)r�r�rd)r�rer$bscs��fdd�}|S)a�Decorator raising SkipTest if a hashing algorithm is not available

    The hashing algorithm could be missing or blocked by a strict crypto
    policy.

    If 'openssl' is True, then the decorator checks that OpenSSL provides
    the algorithm. Otherwise the check falls back to built-in
    implementations.

    ValueError: [digital envelope routines: EVP_DigestInit_ex] disabled for FIPS
    ValueError: unsupported hash type md4
    cstj�����fdd��}|S)NcsXy&�rtdk	rtj��n
tj��Wn&tk
rLtjd��d���YnX�||�S)Nz
hash digest 'z' is not available.)�_hashlib�new�hashlibr�rsrt)r��kwargs)�
digestnamer��opensslrdrer��sz7requires_hashdigest.<locals>.decorator.<locals>.wrapper)r�r�)r�r�)rr)r�rer��sz&requires_hashdigest.<locals>.decoratorrd)rrr�rd)rrrer%}s
z	127.0.0.1z::1cCs"tj||�}t|�}|j�~|S)a�
Returns an unused port that should be suitable for binding.  This is
    achieved by creating a temporary socket with the same family and type as
    the 'sock' parameter (default is AF_INET, SOCK_STREAM), and binding it to
    the specified host address (defaults to 0.0.0.0) with the port set to 0,
    eliciting an unused ephemeral port from the OS.  The temporary socket is
    then closed and deleted, and the ephemeral port is returned.

    Either this method or bind_port() should be used for any tests where a
    server socket needs to be bound to a particular port for the duration of
    the test.  Which one to use depends on whether the calling code is creating
    a python socket, or if an unused port needs to be provided in a constructor
    or passed to an external program (i.e. the -accept argument to openssl's
    s_server mode).  Always prefer bind_port() over find_unused_port() where
    possible.  Hard coded ports should *NEVER* be used.  As soon as a server
    socket is bound to a hard coded port, the ability to run multiple instances
    of the test simultaneously on the same host is compromised, which makes the
    test a ticking time bomb in a buildbot environment. On Unix buildbots, this
    may simply manifest as a failed test, which can be recovered from without
    intervention in most cases, but on Windows, the entire python process can
    completely and utterly wedge, requiring someone to log in to the buildbot
    and manually kill the affected process.

    (This is easy to reproduce on Windows, unfortunately, and can be traced to
    the SO_REUSEADDR socket option having different semantics on Windows versus
    Unix/Linux.  On Unix, you can't have two AF_INET SOCK_STREAM sockets bind,
    listen and then accept connections on identical host/ports.  An EADDRINUSE
    OSError will be raised at some point (depending on the platform and
    the order bind and listen were called on each socket).

    However, on Windows, if SO_REUSEADDR is set on the sockets, no EADDRINUSE
    will ever be raised when attempting to bind two identical host/ports. When
    accept() is called on each socket, the second caller's process will steal
    the port from the first caller, leaving them both in an awkwardly wedged
    state where they'll no longer respond to any signals or graceful kills, and
    must be forcibly killed via OpenProcess()/TerminateProcess().

    The solution on Windows is to use the SO_EXCLUSIVEADDRUSE socket option
    instead of SO_REUSEADDR, which effectively affords the same semantics as
    SO_REUSEADDR on Unix.  Given the propensity of Unix developers in the Open
    Source world compared to Windows ones, this is a common mistake.  A quick
    look over OpenSSL's 0.9.8g source shows that they use SO_REUSEADDR when
    openssl.exe is called with the 's_server' option, for example. See
    http://bugs.python.org/issue2550 for more info.  The following site also
    has a very thorough description about the implications of both REUSEADDR
    and EXCLUSIVEADDRUSE on Windows:
    http://msdn2.microsoft.com/en-us/library/ms740621(VS.85).aspx)

    XXX: although this approach is a vast improvement on previous attempts to
    elicit unused ports, it rests heavily on the assumption that the ephemeral
    port returned to us by the OS won't immediately be dished back out to some
    other process when we close and delete our temporary socket but before our
    calling code has a chance to bind the returned port.  We can deal with this
    issue if/when we come across it.
    )�socketrH�close)�familyZsocktypeZtempsock�portrdrdrerG�s
8cCs�|jtjkr�|jtjkr�ttd�r>|jtjtj�dkr>t	d��ttd�r~y |jtjtj
�dkrft	d��Wntk
r|YnXttd�r�|jtjtj
d�|j|df�|j�d}|S)a%Bind the socket to a free port and return the port number.  Relies on
    ephemeral ports in order to ensure we are using an unbound port.  This is
    important as many tests may be running simultaneously, especially in a
    buildbot environment.  This method raises an exception if the sock.family
    is AF_INET and sock.type is SOCK_STREAM, *and* the socket has SO_REUSEADDR
    or SO_REUSEPORT set on it.  Tests should *never* set these socket options
    for TCP/IP sockets.  The only case for setting these options is testing
    multicasting via multiple UDP sockets.

    Additionally, if the SO_EXCLUSIVEADDRUSE socket option is available (i.e.
    on Windows), it will be set on the socket.  This will prevent anyone else
    from bind()'ing to our host/port for the duration of the test.
    �SO_REUSEADDRrzHtests should never set the SO_REUSEADDR socket option on TCP/IP sockets!�SO_REUSEPORTzHtests should never set the SO_REUSEPORT socket option on TCP/IP sockets!�SO_EXCLUSIVEADDRUSEr)rr�AF_INETr��SOCK_STREAMr�Z
getsockoptZ
SOL_SOCKETrr
rr�Z
setsockoptr�bindZgetsockname)�sock�hostrrdrdrerH�s


cCs:y|j|�Wn&tk
r4|j�tjd��YnXdS)zBBind a unix socket, raising SkipTest if PermissionError is raised.zcannot bind AF_UNIX socketsN)r�PermissionErrorrrsrt)rZaddrrdrdrerJs
cCsZtjrVd}z<y"tjtjtj�}|jtdf�dStk
rBYnXWd|rT|j�XdS)z+Check whether IPv6 is enabled on this host.NrTF)rZhas_ipv6ZAF_INET6r
r�HOSTv6r�r)rrdrdre�_is_ipv6_enableds

rcstj���fdd��}|S)z5Skip the test on TLS certificate validation failures.csNy�||�Wn:tk
rH}zdt|�kr6tjd���WYdd}~XnXdS)NZCERTIFICATE_VERIFY_FAILEDz.system does not contain necessary certificates)�IOErrorrursrt)r�r�r�)r�rdre�decs
z&system_must_validate_cert.<locals>.dec)r�r�)r�rrd)r�re�system_must_validate_certs	rr�i�ZdoubleZIEEEztest requires IEEE 754 doublesz
requires zlibz
requires gzipzrequires bz2z
requires lzma�java�ANDROID_API_LEVEL�win32z/system/bin/shz/bin/shz$testz@testz	{}_{}_tmp�æ�İ�Ł�φ�К�א�،�ت�ก� �€u-àòɘŁğr�ZNFD�ntr�u-共Ł♡ͣ�ztWARNING: The filename %r CAN be encoded by the filesystem encoding (%s). Unicode filename tests may not be effective��s-��surrogateescape��w����������r�ccs�d}|dkr&tj�}d}tjj|�}nBytj|�d}Wn.tk
rf|sN�tjd|t	dd�YnX|rttj
�}z
|VWd|r�|tj
�kr�t|�XdS)a�Return a context manager that creates a temporary directory.

    Arguments:

      path: the directory to create temporarily.  If omitted or None,
        defaults to creating a temporary directory using tempfile.mkdtemp.

      quiet: if False (the default), the context manager raises an exception
        on error.  Otherwise, if the path is specified and cannot be
        created, only a warning is issued.

    FNTz+tests may fail, unable to create temp dir: �)r�)�tempfile�mkdtempr�r��realpath�mkdirr�rgr�r��getpidr)r��quietZdir_created�pidrdrdre�temp_dir�s&


r2ccsftj�}ytj|�Wn.tk
rD|s,�tjd|tdd�YnXztj�VWdtj|�XdS)agReturn a context manager that changes the current working directory.

    Arguments:

      path: the directory to use as the temporary current working directory.

      quiet: if False (the default), the context manager raises an exception
        on error.  Otherwise, it issues only a warning and keeps the current
        working directory the same.

    z)tests may fail, unable to change CWD to: r*)r�N)r��getcwd�chdirr�rgr�r�)r�r0Z	saved_dirrdrdre�
change_cwd	s

r5�tempcwdccs:t||d��$}t||d��}|VWdQRXWdQRXdS)a�
    Context manager that temporarily creates and changes the CWD.

    The function temporarily changes the current working directory
    after creating a temporary directory in the current directory with
    name *name*.  If *name* is None, the temporary directory is
    created using tempfile.mkdtemp.

    If *quiet* is False (default) and it is not possible to
    create or change the CWD, an error is raised.  If *quiet* is True,
    only a warning is raised and the original CWD is used.

    )r�r0)r0N)r2r5)rvr0Z	temp_pathZcwd_dirrdrdrer$s�umaskccs&tj|�}z
dVWdtj|�XdS)z8Context manager that temporarily sets the process umask.N)r�r7)r7ZoldmaskrdrdrerK8s

�datacCsbtjj|�r|S|dk	r&tjj||�}tgtj}x*|D]"}tjj||�}tjj|�r8|Sq8W|S)a[Try to find a file on sys.path or in the test directory.  If it is not
    found the argument passed to the function is returned (this does not
    necessarily signal failure; could still be the legitimate path).

    Setting *subdir* indicates a relative path to use to find the file
    rather than looking directly in the path directories.
    N)r�r��isabsr��
TEST_HOME_DIRro�exists)r�Zsubdirr�Zdn�fnrdrdrerIs
cCs(tj|tjtjBtjB�}tj|�dS)z>Create an empty file. If the file already exists, truncate it.N)r��open�O_WRONLY�O_CREAT�O_TRUNCr)r��fdrdrdrer[scCs,t|j��}dd�|D�}dj|�}d|S)z%Like repr(dict), but in sorted order.cSsg|]}d|�qS)z%r: %rrd)�.0Zpairrdrdre�
<listcomp>cszsortdict.<locals>.<listcomp>z, z{%s})�sortedr�r�)�dictr�Z	reprpairsZ
withcommasrdrdrer[`s
cCs*ttd�}z|j�S|j�tt�XdS)z`
    Create an invalid file descriptor by opening and closing a file and return
    its fd.
    �wbN)r=r�filenorr)r�rdrdre�make_bad_fdgs

rH)�lineno�offsetcCsp|jt��}t|dd�WdQRX|j}|j|j�|dk	rJ|j|j|�|j|j�|dk	rl|j|j|�dS)Nz
<test string>�exec)�assertRaises�SyntaxError�compileZ	exceptionZassertIsNotNonerI�assertEqualrJ)�testcaseZ	statementrIrJ�cmr�rdrdrer&sscsVddl}ddl}�jdd��|jj|�djd�d}tjjt	|�}���fdd�}tjj
|�r|||�}|dk	rt|St|�td�t
r�td	|t�d
�|jj�}tr�|jjd�|j|d
d�}tr�|jjd�dkr�tj|d�}zBt|d��.}	|j�}
x|
�r|	j|
�|j�}
�q�WWdQRXWd|j�X||�}|dk	�rF|Std|��dS)Nr�checkr��/rcs>t|f����}�dkr|S�|�r2|jd�|S|j�dS)Nr)r=�seekr)r<r�)r�rRr�rdre�check_valid_file�s
z*open_urlresource.<locals>.check_valid_fileZurlfetchz	fetching %s ...)r��Accept-Encoding�gzip�)r�zContent-Encoding)ZfileobjrFzinvalid resource %r���)rVrW)Zurllib.requestZurllib.parse�pop�parseZurlparser�r�r�r��
TEST_DATA_DIRr;rr!rr�rZrequestZbuild_openerrWZ
addheadersr�r=Zheaders�getZGzipFile�read�writerr
)Zurlr�r��urllibr�r<rUr��opener�out�srd)r�rRr�rerI~s<	



c@s4eZdZdZdd�Zdd�Zedd��Zdd	�Zd
S)�WarningsRecorderzyConvenience wrapper for the warnings list returned on
       entry to the warnings.catch_warnings() context manager.
    cCs||_d|_dS)Nr)�	_warnings�_last)�selfZ
warnings_listrdrdre�__init__�szWarningsRecorder.__init__cCsDt|j�|jkr t|jd|�S|tjjkr0dStd||f��dS)Nrz%r has no attribute %rrY)r�rerfr�rg�WarningMessage�_WARNING_DETAILSr�)rg�attrrdrdre�__getattr__�s
zWarningsRecorder.__getattr__cCs|j|jd�S)N)rerf)rgrdrdrerg�szWarningsRecorder.warningscCst|j�|_dS)N)r�rerf)rgrdrdre�reset�szWarningsRecorder.resetN)	r`rarbrcrhrl�propertyrgrmrdrdrdrerd�s
rdc
cs
tjd�}|jjd�}|r"|j�tjdd�� }tjdjd�t	|�VWdQRXt
|�}g}xz|D]r\}}d}	xH|dd�D]8}|j}
tj
|t|
�tj�r�t|
j|�r�d}	|j|�q�W|	rf|rf|j||jf�qfW|r�td	|d
��|�rtd|d
��dS)z�Catch the warnings, then check if all the expected
    warnings have been raised and re-raise unexpected warnings.
    If 'quiet' is True, only re-raise the unexpected warnings.
    r�Z__warningregistry__T)�recordrg�alwaysNFzunhandled warning %srz)filter (%r, %s) did not catch any warning)ro�	_getframe�	f_globalsr]�clearrgrhrz�simplefilterrdr|�message�re�matchru�I�
issubclassr��remover�r`�AssertionError)�filtersr0�frame�registry�wZreraiseZmissingrx�cat�seenZwarningrdrdre�_filterwarnings�s0
r�cOs.|jd�}|s$dtff}|dkr$d}t||�S)a�Context manager to silence warnings.

    Accept 2-tuples as positional arguments:
        ("message regexp", WarningCategory)

    Optional argument:
     - if 'quiet' is True, it does not fail if a filter catches nothing
        (default True without argument,
         default False if some filters are defined)

    Without argument, it defaults to:
        check_warnings(("", Warning), quiet=True)
    r0r�NT)r]�Warningr�)r|r�r0rdrdrerR�s

r�ccsHtjdd��&}tjd||d�dV|r.t�WdQRX|j|g�dS)a�Context manager to check that no warnings are emitted.

    This context manager enables a given warning within its scope
    and checks that no warnings are emitted even with that warning
    enabled.

    If force_gc is True, a garbage collection is attempted before checking
    for warnings. This may help to catch warnings emitted when objects
    are deleted, such as ResourceWarning.

    Other keyword arguments are passed to warnings.filterwarnings().
    T)rorp)ru�categoryN)rgrhri�
gc_collectrO)rPrur�Zforce_gc�warnsrdrdre�check_no_warningssr�ccsBtjdd�� }tjdtd�dVt�WdQRX|j|g�dS)a"Context manager to check that no ResourceWarning is emitted.

    Usage:

        with check_no_resource_warning(self):
            f = open(...)
            ...
            del f

    You must remove the object which may emit ResourceWarning before
    the end of the context manager.
    T)rorp)r�N)rgrhri�ResourceWarningr�rO)rPr�rdrdrerSs
c@s(eZdZdZdd�Zdd�Zdd�ZdS)	ra,Context manager to force import to return a new module reference.

    This is useful for testing module-level behaviours, such as
    the emission of a DeprecationWarning on import.

    Use like this:

        with CleanImport("foo"):
            importlib.import_module("foo") # new reference
    cGsNtjj�|_x<|D]4}|tjkrtj|}|j|kr>tj|j=tj|=qWdS)N)rorz�copy�original_modulesr`)rgZmodule_namesZmodule_namer�rdrdrerh?s




zCleanImport.__init__cCs|S)Nrd)rgrdrdre�	__enter__LszCleanImport.__enter__cGstjj|j�dS)N)rorzr�r�)rg�
ignore_excrdrdre�__exit__OszCleanImport.__exit__N)r`rarbrcrhr�r�rdrdrdrer3s

c@sheZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)rTz_Class to help protect the environment variable properly.  Can be used as
    a context manager.cCstj|_i|_dS)N)r��environ�_environ�_changed)rgrdrdrerhXszEnvironmentVarGuard.__init__cCs
|j|S)N)r�)rg�envvarrdrdre�__getitem__\szEnvironmentVarGuard.__getitem__cCs*||jkr|jj|�|j|<||j|<dS)N)r�r�r])rgr��valuerdrdre�__setitem___s
zEnvironmentVarGuard.__setitem__cCs2||jkr|jj|�|j|<||jkr.|j|=dS)N)r�r�r])rgr�rdrdre�__delitem__es

zEnvironmentVarGuard.__delitem__cCs
|jj�S)N)r��keys)rgrdrdrer�lszEnvironmentVarGuard.keyscCs
t|j�S)N)�iterr�)rgrdrdre�__iter__oszEnvironmentVarGuard.__iter__cCs
t|j�S)N)r�r�)rgrdrdre�__len__rszEnvironmentVarGuard.__len__cCs|||<dS)Nrd)rgr�r�rdrdre�setuszEnvironmentVarGuard.setcCs
||=dS)Nrd)rgr�rdrdre�unsetxszEnvironmentVarGuard.unsetcCs|S)Nrd)rgrdrdrer�{szEnvironmentVarGuard.__enter__cGsJx<|jj�D].\}}|dkr0||jkr:|j|=q||j|<qW|jt_dS)N)r�r�r�r�r�)rgr��k�vrdrdrer�~s

zEnvironmentVarGuard.__exit__N)r`rarbrcrhr�r�r�r�r�r�r�r�r�r�rdrdrdrerTSsc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�
DirsOnSysPatha�Context manager to temporarily add directories to sys.path.

    This makes a copy of sys.path, appends any directories given
    as positional arguments, then reverts sys.path to the copied
    settings when the context ends.

    Note that *all* sys.path modifications in the body of the
    context manager, including replacement of the object,
    will be reverted at the end of the block.
    cGs(tjdd�|_tj|_tjj|�dS)N)ror��original_value�original_object�extend)rg�pathsrdrdrerh�szDirsOnSysPath.__init__cCs|S)Nrd)rgrdrdrer��szDirsOnSysPath.__enter__cGs|jt_|jtjdd�<dS)N)r�ror�r�)rgr�rdrdrer��szDirsOnSysPath.__exit__N)r`rarbrcrhr�r�rdrdrdrer��s
r�c@s*eZdZdZdd�Zdd�Zd	dd�ZdS)
r'z�Raise ResourceDenied if an exception is raised while the context manager
    is in effect that matches the specified exception and attributes.cKs||_||_dS)N)r��attrs)rgr�r�rdrdrerh�szTransientResource.__init__cCs|S)Nrd)rgrdrdrer��szTransientResource.__enter__NcCsT|dk	rPt|j|�rPx:|jj�D]$\}}t||�s4Pt||�|kr Pq Wtd��dS)z�If type_ is a subclass of self.exc and value has attributes matching
        self.attrs, raise ResourceDenied.  Otherwise let the exception
        propagate (if any).Nz%an optional resource is not available)ryr�r�r�r�r�r)rgZtype_r��	tracebackrkZ
attr_valuerdrdrer��s
zTransientResource.__exit__)NNN)r`rarbrcrhr�r�rdrdrdrer'�s)�errnog>@)r��errnosc	#spd!d"d#d$d%d&g}d(d*d,d.d/g}td|��|�g��sRdd�|D��dd�|D�����fdd�}tj�}z�y|dk	r�tj|�dVWn�tjk
�r�}z&tr�tjj	�j
dd��|�WYdd}~Xn�tk
�rZ}zpx^|j
}t|�d k�rt
|dt��r|d}n*t|�dk�r8t
|d t��r8|d }nP�q�W||��WYdd}~XnXWdtj|�XdS)0z�Return a context manager that raises ResourceDenied when various issues
    with the Internet connection manifest themselves as exceptions.�ECONNREFUSED�o�
ECONNRESET�h�EHOSTUNREACH�q�ENETUNREACH�e�	ETIMEDOUT�n�
EADDRNOTAVAIL�c�	EAI_AGAINr*�EAI_FAILr��
EAI_NONAMEr��
EAI_NODATA��
WSANO_DATA�*zResource %r is not availablecSsg|]\}}tt||��qSrd)r�r�)rBrv�numrdrdrerC�sz&transient_internet.<locals>.<listcomp>cSsg|]\}}tt||��qSrd)r�r)rBrvr�rdrdrerC�scs�t|dd�}t|tj�s�t|tj�r,|�ks�t|tjj�rTd|jkoNdkns�t|tjj	�r�d|j
ks�d|j
ks�d|j
ks�|�kr�ts�tj
j�jdd��|�dS)	Nr�i�iW�ConnectionRefusedError�TimeoutError�EOFErrorr�
)r��
isinstancerr�Zgaierrorr`�errorZ	HTTPError�codeZURLErrorr�rro�stderrr_r�)r��n)�captured_errnos�denied�
gai_errnosrdre�filter_error�s


z(transient_internet.<locals>.filter_errorNrr�r)r�r�)r�r�)r�r�)r�r�)r�r�)r�r����)r�r����)r�r����)r�r����)r�r�)r�r�)rrZgetdefaulttimeoutZsetdefaulttimeout�nntplibZNNTPTemporaryErrorrror�r_r�r�r�r�)	Z
resource_namer�r�Zdefault_errnosZdefault_gai_errnosr�Zold_timeoutr��ard)r�r�r�rer+�sP



c
csFddl}tt|�}tt||j��ztt|�VWdtt||�XdS)z�Return a context manager used by captured_stdout/stdin/stderr
    that temporarily replaces the sys stream *stream_name* with a StringIO.rN)�ior�ro�setattr�StringIO)Zstream_namer�Zorig_stdoutrdrdre�captured_outputs
r�cCstd�S)z�Capture the output of sys.stdout:

       with captured_stdout() as stdout:
           print("hello")
       self.assertEqual(stdout.getvalue(), "hello\n")
    r�)r�rdrdrdrerscCstd�S)z�Capture the output of sys.stderr:

       with captured_stderr() as stderr:
           print("hello", file=sys.stderr)
       self.assertEqual(stderr.getvalue(), "hello\n")
    r�)r�rdrdrdrer%scCstd�S)a	Capture the input to sys.stdin:

       with captured_stdin() as stdin:
           stdin.write('hello\n')
           stdin.seek(0)
           # call test code that consumes from sys.stdin
           captured = input()
       self.assertEqual(captured, "hello")
    �stdin)r�rdrdrdrer.s
cCs*tj�trtjd�tj�tj�dS)a�Force as many objects as possible to be collected.

    In non-CPython implementations of Python, this is needed because timely
    deallocation is not guaranteed by the garbage collector.  (Even in CPython
    this can be the case in case of reference cycles.)  This means that __del__
    methods may be called later than expected and weakrefs may remain alive for
    longer than expected.  This function tries its best to force all garbage
    objects to disappear.
    g�������?N)�gcZcollectr@r�r�rdrdrdrer�;s


r�c
cs.tj�}tj�z
dVWd|r(tj�XdS)N)r��	isenabled�disable�enable)Zhave_gcrdrdre�
disable_gcKs
r�cCs:tjd�pd}d}x|j�D]}|jd�r|}qW|dkS)z,Find if Python was built with optimizations.�	PY_CFLAGSr�z-O�-O0�-Og)r�r�r�)�	sysconfig�get_config_varr�rq)ZcflagsZ	final_optr�rdrdre�python_is_optimizedVs
r�ZnPZ0n�gettotalrefcountZ2PZ0Pr�cCstjt|t�S)N)�struct�calcsize�_header�_align)�fmtrdrdre�calcobjsizegsr�cCstjt|t�S)N)r�r��_vheaderr�)r�rdrdre�calcvobjsizejsr���	cCspddl}tj|�}t|�tkr(|jt@sBt|�tkrLt|�jt@rL||j7}dt|�||f}|j|||�dS)Nrz&wrong size for %s: got %d, expected %d)	�	_testcapiro�	getsizeofr��	__flags__�_TPFLAGS_HEAPTYPE�_TPFLAGS_HAVE_GCZSIZEOF_PYGC_HEADrO)�test�o�sizer�r�rxrdrdre�check_sizeofqs

r�cs��fdd�}|S)Ncs$���fdd�}�j|_�j|_|S)Ncs�y ddl}t|��}|j|�}Wn(tk
r6�YnBd}}Yn0Xx,�D]$}y|j||�PWqPYqPXqPWz
�||�S|r�|r�|j||�XdS)Nr)�localer��	setlocaler�)r��kwdsr�r�Zorig_locale�loc)�catstrr��localesrdre�inner�s$



z1run_with_locale.<locals>.decorator.<locals>.inner)r`rc)r�r�)r�r�)r�rer��sz"run_with_locale.<locals>.decoratorrd)r�r�r�rd)r�r�rerU�scs�fdd�}|S)Ncs"��fdd�}�j|_�j|_|S)Ncs�y
tj}Wntk
r(tjd��YnXdtjkr@tjd}nd}�tjd<|�z
�||�S|dkrrtjd=n
|tjd<tj�XdS)Nztzset requiredZTZ)r��tzsetr�rsrtr�r�)r�r�r�Zorig_tz)r��tzrdrer��s





z-run_with_tz.<locals>.decorator.<locals>.inner)r`rc)r�r�)r�)r�rer��szrun_with_tz.<locals>.decoratorrd)r�r�rd)r�rer\�scCs�dttdtd�}tjd|tjtjB�}|dkr>td|f��tt|j	d��||j	d�j
��}|a|tkrrt}|t
dkr�td|f��|adS)Ni)r��m�g�tz(\d+(\.\d+)?) (K|M|G|T)b?$zInvalid memory limit %rrr*z$Memory limit %r too low to be useful)�_1M�_1Grvrw�
IGNORECASE�VERBOSEr�r��float�group�lower�real_max_memuse�MAX_Py_ssize_t�_2Gr)�limitZsizesr�ZmemlimitrdrdrerY�s$c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_MemoryWatchdogz`An object which periodically watches the process' memory consumption
    and prints it out.
    cCsdjtj�d�|_d|_dS)Nz/proc/{pid}/statm)r1F)r�r�r/�procfile�started)rgrdrdrerh�sz_MemoryWatchdog.__init__cCs�yt|jd�}Wn<tk
rL}z tjdj|�t�tjj	�dSd}~XnXt
d�}tjtj
|g|tjd�|_|j�d|_dS)N�rz!/proc not available for stats: {}zmemory_watchdog.py)r�r�T)r=r
r�rgr�r�r�ror��flushr�
subprocess�Popen�
executableZDEVNULL�mem_watchdogrr)rgr�r�Zwatchdog_scriptrdrdre�start�s
z_MemoryWatchdog.startcCs|jr|jj�|jj�dS)N)rrZ	terminate�wait)rgrdrdre�stop�s
z_MemoryWatchdog.stopN)r`rarbrcrhrrrdrdrdrer	�sr	cs���fdd�}|S)atDecorator for bigmem tests.

    'size' is a requested size for the test (in arbitrary, test-interpreted
    units.) 'memuse' is the number of bytes per unit for the test, or a good
    estimate of it. For example, a test that needs two byte buffers, of 4 GiB
    each, could be decorated with @bigmemtest(size=_4G, memuse=2).

    The 'size' argument is normally passed to the decorated test method as an
    extra argument. If 'dry_run' is true, the value passed to the test method
    may be less than the requested value. If 'dry_run' is false, it means the
    test doesn't support dummy runs when -M is not specified.
    cs ���fdd����_��_�S)Nc
s��j}�j}tsd}n|}ts$�rFt||krFtjd||d��tr|tr|t�tdj||dd��t�}|j	�nd}z
�||�S|r�|j
�XdS)	Niz'not enough memory: %.1fG minimum neededir*z* ... expected peak memory use: {peak:.1f}G)Zpeaki@i@)r��memuserrsrtrr�r�r	rr)rgr�r�maxsizeZwatchdog)�dry_runr�r�rdrer�s*


z.bigmemtest.<locals>.decorator.<locals>.wrapper)r�r)r�)rrr�)r�r�rer�szbigmemtest.<locals>.decoratorrd)r�rrr�rd)rrr�rer3s
!cs�fdd�}|S)z0Decorator for tests that fill the address space.csDttkr8td
kr$tdkr$tjd��q@tjdtd��n�|�SdS)
Nr��?r�z-not enough memory: try a 32-bit build insteadz'not enough memory: %.1fG minimum neededir*ll����li@)rrrsrt)rg)r�rdrer�3sz!bigaddrspacetest.<locals>.wrapperrd)r�r�rd)r�rer41sc@seZdZdd�ZdS)r,cCstj�}||�|S)N)rsZ
TestResult)rgr�r�rdrdre�runDszBasicTestRunner.runN)r`rarbrrdrdrdrer,CscCs|S)Nrd)r�rdrdre�_idIsrcCs<|dkrt�rtjtj�St|�r(tStjdj|��SdS)Nr�zresource {0!r} is not enabled)r�rs�skipr�r rr�)r�rdrdre�requires_resourceLs
rcCs&trt|krtjd|tf�StSdS)Nz%s at Android API level %d)rA�_ANDROID_API_LEVELrsrr)�levelr�rdrdrer>TscCstdd�|�S)z9
    Decorator for tests only applicable on CPython.
    T)�cpython)�impl_detail)r�rdrdrer5[scKsVtf|�rtS|dkrLt|�\}}|r,d}nd}t|j��}|jdj|��}tj|�S)Nz*implementation detail not available on {0}z%implementation detail specific to {0}z or )	rBr�
_parse_guardsrDr�r�r�rsr)rx�guardsZ
guardnames�defaultrdrdrer!as
r!cCsTtdkr:ddl}y|j�daWntk
r8daYnXd}trF|Stj|�|�S)z8Skip decorator for tests that use multiprocessing.Queue.NrTFz6requires a functioning shared semaphore implementation)�_have_mp_queue�multiprocessingZQueuernrsr)r�r&rxrdrdrer?os
cCs*|sddidfSt|j��d}||fS)Nr TFr)r|�values)r#Zis_truerdrdrer"~sr"cKs t|�\}}|jtj�j�|�S)a5This function returns True or False depending on the host platform.
       Examples:
          if check_impl_detail():               # only on CPython (default)
          if check_impl_detail(jython=True):    # only on Jython
          if check_impl_detail(cpython=False):  # everywhere except on CPython
    )r"r]rpZpython_implementationr)r#r$rdrdrerB�scs,ttd�s�Stj���fdd��}|SdS)zEDecorator to temporarily turn off tracing for the duration of a test.�gettracecs.tj�}ztjd��||�Stj|�XdS)N)ror(�settrace)r�r�Zoriginal_trace)r�rdrer��s


zno_tracing.<locals>.wrapperN)r�ror�r�)r�r�rd)r�re�
no_tracing�s
r*cCstt|��S)aDecorator for tests which involve reference counting.

    To start, the decorator does not run the test if is not run by CPython.
    After that, any trace function is unset during the test to prevent
    unexpected refcounts caused by the trace function.

    )r*r5)r�rdrdre�
refcount_test�sr+cCsRg}xB|jD]8}t|tj�r2t||�|j|�q||�r|j|�qW||_dS)z>Recursively filter test cases in a suite based on a predicate.N)Z_testsr�rs�	TestSuite�
_filter_suiter�)�suiteZpredZnewtestsr�rdrdrer-�s
r-cCs�ttjttdk	d�}|j|�}tdk	r4tj|j��|js>t	�|j
�s�t|j�dkrl|j
rl|jdd}n6t|j
�dkr�|jr�|j
dd}nd}ts�|d7}t|��dS)z2Run tests from a unittest.TestSuite-derived class.N)�	verbosityZcapture_outputrrzmultiple errors occurredz!; run in verbose mode for details)rror�r�junit_xml_listrr�Zget_xml_elementZtestsRunrZ
wasSuccessfulr��errorsZfailuresr
)r.Zrunnerr�r�rdrdre�
_run_suite�s"
r2cCstdkrdSt|j��SdS)NT)�_match_test_func�id)r�rdrdre�
match_test�sr5cCsd|kotjd|�S)Nryz[?*\[\]])rv�search)r�rdrdre�_is_full_match_test�sr7csr|tkrdS|sd}f}nHttt|��r4t|�j}n.djttj|��}t	j
|�j��fdd�}|}t|�a|a
dS)N�|cs$�|�rdStt�|jd���SdS)NTry)�anyr�r�)Ztest_id)�regex_matchrdre�match_test_regex�sz)set_match_tests.<locals>.match_test_regex)�_match_test_patterns�allr�r7r��__contains__r��fnmatch�	translatervrNrwrrr3)Zpatternsr�Zregexr;rd)r:re�set_match_tests�srAcGs�tjtjf}tj�}xh|D]`}t|t�rT|tjkrJ|jtjtj|��qzt	d��qt||�rj|j|�q|jtj
|��qWt|t�t
|�dS)z1Run tests from unittest.TestCase-derived classes.z)str arguments must be keys in sys.modulesN)rsr,ZTestCaser�rurorzZaddTestZ
findTestCasesr�Z	makeSuiter-r5r2)�classesZvalid_typesr.�clsrdrdrer-s





cCsdS)z,Just used to check if docstrings are enabledNrdrdrdrdre�_check_docstrings(srD�WITH_DOC_STRINGSztest requires docstringscCs`ddl}|dkrt}nd}|j|||d�\}}|rBtd||f��trXtd|j|f�||fS)aRun doctest on the given module.  Return (#failures, #tests).

    If optional argument verbosity is not specified (or is None), pass
    support's belief about verbosity on to doctest.  Else doctest's
    usual behavior is used (it searches sys.argv for -v).
    rN)r�optionflagsz%d of %d doctests failedz,doctest (%s) ... %d tests with zero failures)�doctestrZtestmodr
r�r`)r�r/rFrGr�r�rdrdrer.9scCstjj�fS)N)rorzr�rdrdrdre�
modules_setupTsrHcCs:dd�tjj�D�}tjj�tjj|�tjj|�dS)NcSs"g|]\}}|jd�r||f�qS)z
encodings.)rq)rBr�r�rdrdrerC[sz#modules_cleanup.<locals>.<listcomp>)rorzr�rsr�)Z
oldmodulesZ	encodingsrdrdre�modules_cleanupWs
rIcCs"trtj�tjj�fSdffSdS)Nr)�_thread�_count�	threading�	_danglingr�rdrdrdrerNzscGsJtsdSd}x8t|�D],}tj�tjf}||kr2Ptjd�t�qWdS)N�dg{�G�z�?)rJ�rangerKrLrMr�r�r�)Zoriginal_valuesZ
_MAX_COUNT�countr'rdrdrerO�s
cs"ts�Stj���fdd��}|S)z�Use this function when threads are being used.  This will
    ensure that the threads are cleaned up even when the test fails.
    If threading is unavailable this function does nothing.
    cst�}z�|�St|�XdS)N)rNrO)r��key)r�rdrer��szreap_threads.<locals>.decorator)rJr�r�)r�r�rd)r�rerP�s�N@ccs�tj�}z
dVWdtj�}||}xjtj�}||kr8Ptj�|kr|tj�|}d||�d|d�d|�d|�d�	}t|��tjd�t�q&WXdS)	aH
    bpo-31234: Context manager to wait until all threads created in the with
    statement exit.

    Use _thread.count() to check if threads exited. Indirectly, wait until
    threads exit the internal t_bootstrap() C function of the _thread module.

    threading_setup() and threading_cleanup() are designed to emit a warning
    if a test leaves running threads in the background. This context manager
    is designed to cleanup threads started by the _thread.start_new_thread()
    which doesn't allow to wait for thread exit, whereas thread.Thread has a
    join() method.
    Nz!wait_threads() failed to cleanup z threads after z.1fz seconds (count: z
, old count: �)g{�G�z�?)rJrKr�Z	monotonicr{r�r�)r�Z	old_countZ
start_timeZdeadlinerPZdtrxrdrdre�wait_threads_exit�s
$
rTc
CsZttd�rVd}xFy2tj|tj�\}}|dkr.Ptd|tjd�WqPYqXqWdS)z�Use this function at the end of test_main() whenever sub-processes
    are started.  This will help ensure that no extra children (zombies)
    stick around to hog resources and create problems when looking
    for refleaks.
    �waitpidrrz2Warning -- reap_children() reaped child process %s)r�NrY)r�r�rU�WNOHANGr�ror�)Zany_processr1ZstatusrdrdrerL�s
ccs*t|�}g}zZy$x|D]}|j�|j|�qWWn*trVtdt|�t|�f��YnXdVWdz�|rt|�tj�}}xltdd�D]^}|d7}x$|D]}|jt	|tj�d��q�Wdd�|D�}|s�Ptr�tdt|�|f�q�WWdd	d�|D�}|�r"t
jtj
�td
t|���XXdS)Nz/Can't start %d threads, only %d threads startedrr�<g{�G�z�?cSsg|]}|j�r|�qSrd)�isAlive)rBr�rdrdrerC�sz!start_threads.<locals>.<listcomp>z7Unable to join %d threads during a period of %d minutescSsg|]}|j�r|�qSrd)rX)rBr�rdrdrerC�szUnable to join %d threads)r|rr�rr�r�r�rOr��max�faulthandlerZdump_tracebackror�r{)ZthreadsZunlockrr�ZendtimeZ	starttimer�rdrdrerQ�s>


c
csnt||�r<t||�}t|||�z
|VWdt|||�Xn.t|||�z
dVWdt||�rht||�XdS)a�Temporary swap out an attribute with a new object.

    Usage:
        with swap_attr(obj, "attr", 5):
            ...

        This will set obj.attr to 5 for the duration of the with: block,
        restoring the old value at the end of the block. If `attr` doesn't
        exist on `obj`, it will be created and then deleted at the end of the
        block.

        The old value (or None if it doesn't exist) will be assigned to the
        target of the "as" clause, if there is one.
    N)r�r�r��delattr)r�rk�new_val�real_valrdrdrerW�s




ccsX||kr0||}|||<z
|VWd|||<Xn$|||<z
dVWd||krR||=XdS)a�Temporary swap out an item with a new object.

    Usage:
        with swap_item(obj, "item", 5):
            ...

        This will set obj["item"] to 5 for the duration of the with: block,
        restoring the old value at the end of the block. If `item` doesn't
        exist on `obj`, it will be created and then deleted at the end of the
        block.

        The old value (or None if it doesn't exist) will be assigned to the
        target of the "as" clause, if there is one.
    Nrd)r��itemr\r]rdrdrerV	s

cCstjdd|�j�}|S)z�Strip the stderr of a Python process from potential debug output
    emitted by the interpreter.

    This will typically be run on the result of the communicate() method
    of a subprocess.Popen object.
    s\[\d+ refs, \d+ blocks\]\r?\n?�)rv�sub�strip)r�rdrdre�strip_python_stderr8	srbZ	getcountsz-types are immortal if COUNT_ALLOCS is definedcCstj�S)znReturn a list of command-line arguments reproducing the current
    settings in sys.flags and sys.warnoptions.)rZ_args_from_interpreter_flagsrdrdrdre�args_from_interpreter_flagsE	srccCstj�S)zgReturn a list of command-line arguments reproducing the current
    optimization settings in sys.flags.)rZ"_optim_args_from_interpreter_flagsrdrdrdre�!optim_args_from_interpreter_flagsJ	srdc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rMcCstjjj|d�||_dS)Nr)�logging�handlers�BufferingHandlerrh�matcher)rgrhrdrdrerhT	szTestHandler.__init__cCsdS)NFrd)rgrdrdre�shouldFlush]	szTestHandler.shouldFlushcCs|j|�|jj|j�dS)N)r�r�r��__dict__)rgrordrdre�emit`	s
zTestHandler.emitcKs.d}x$|jD]}|jj|f|�rd}PqW|S)zW
        Look for a saved dict whose keys/values match the supplied arguments.
        FT)r�rh�matches)rgr�r��drdrdrerld	szTestHandler.matchesN)r`rarbrhrirkrlrdrdrdrerMS	s	c@s eZdZdZdd�Zdd�ZdS)	rXrxrucKs<d}x2|D]*}||}|j|�}|j|||�s
d}Pq
W|S)a.
        Try to match a single dict with the supplied arguments.

        Keys whose values are strings and which are in self._partial_matches
        will be checked for partial (i.e. substring) matches. You can extend
        this scheme to (for example) do regular expression matching, etc.
        TF)r]�match_value)rgrmr�r�r�r��dvrdrdrerls	s

zMatcher.matchescCsHt|�t|�krd}n.t|�tk	s,||jkr6||k}n|j|�dk}|S)zT
        Try to match a single stored value (dv) with a supplied value (v).
        Fr)r�ru�_partial_matches�find)rgr�ror�r�rdrdrern�	s
zMatcher.match_valueN)rxru)r`rarbrprlrnrdrdrdrerXo	sc
CsZtdk	rtStd}ytjt|�d}Wntttfk
rFd}YnXtj|�|a|S)NrTF)�_can_symlinkrr��symlinkr��NotImplementedErrorr�rz)Zsymlink_path�canrdrdrer�	s

cCs t�}d}|r|Stj|�|�S)z8Skip decorator for tests that require functional symlinkz*Requires functional symlink implementation)rrsr)r��okrxrdrdrer/�	scCs�tdk	rtSttd�sd}n�tj�}tj|d�\}}z�ttd���}y`tj|dd�tj|dd�tj|j	�dd�t
j�}tj
d	|�}|dkp�t|jd
��dk}Wntk
r�d}YnXWdQRXWdtt�t|�t|�X|a|S)N�setxattrF)�dirrFs	user.testr_strusted.foos42z
2.6.(\d{1,2})r�')�
_can_xattrr�r�r+r,Zmkstempr=rrwrGrpr�rvrwr�rr�rr�)ruZtmp_dirZtmp_fpZtmp_name�fpZkernel_versionr�rdrdre�	can_xattr�	s,

r|cCs t�}d}|r|Stj|�|�S)zDSkip decorator for tests that require functional extended attributesz(no non-broken extended attribute support)r|rsr)r�rvrxrdrdrer8�	scCs$tpt}d}|r|Stj|�|�S)z;Skip decorator for tests not run in (non-extended) PGO taskz#Not run for (non-extended) PGO task)r]�PGO_EXTENDEDrsr)r�rvrxrdrdre�skip_if_pgo_task�	s
r~cCs^tj|d��H}|j}|j�}||kr,|j�}ytjj||�Stk
rNdSXWdQRXdS)zKDetects if the file system for the specified directory is case-insensitive.)rxFN)	r+ZNamedTemporaryFilerv�upperrr�r��samefiler�)Z	directory�base�	base_pathZ	case_pathrdrdrer�	s)rfcCs>tt|��tt|��}|r(|t|�8}tdd�|D��}|S)aReturns the set of items in ref_api not in other_api, except for a
    defined list of items to be ignored in this check.

    By default this skips private attributes beginning with '_' but
    includes all magic methods, i.e. those starting and ending in '__'.
    css(|] }|jd�s|jd�r|VqdS)�_�__N)rq�endswith)rBr�rdrdre�	<genexpr>�	sz&detect_api_mismatch.<locals>.<genexpr>)r�rx)Zref_apiZ	other_apirfZ
missing_itemsrdrdrer<�	s
cCs�|dkr|jf}nt|t�r"|f}t|�}xbt|�D]V}|jd�s4||krLq4t||�}t|dd�|ks�t|d�r4t|tj	�r4|j
|�q4W|j|j|�dS)aAssert that the __all__ variable of 'module' contains all public names.

    The module's public names (its API) are detected automatically based on
    whether they match the public name convention and were defined in
    'module'.

    The 'name_of_module' argument can specify (as a string or tuple thereof)
    what module(s) an API could be defined in in order to be detected as a
    public API. One case for this is when 'module' imports part of its public
    API from other modules, possibly a C backend (like 'csv' and its '_csv').

    The 'extra' argument can be a set of names that wouldn't otherwise be
    automatically detected as "public", like objects without a proper
    '__module__' attribute. If provided, it will be added to the
    automatically detected ones.

    The 'blacklist' argument can be a set of names that must not be treated
    as part of the public API even though their names indicate otherwise.

    Usage:
        import bar
        import foo
        import unittest
        from test import support

        class MiscTestCase(unittest.TestCase):
            def test__all__(self):
                support.check__all__(self, foo)

        class OtherTestCase(unittest.TestCase):
            def test__all__(self):
                extra = {'BAR_CONST', 'FOO_CONST'}
                blacklist = {'baz'}  # Undocumented name.
                # bar imports part of its API from _bar.
                support.check__all__(self, bar, ('bar', '_bar'),
                                     extra=extra, blacklist=blacklist)

    Nr�ra)
r`r�rur�rxrqr�r��types�
ModuleType�addZassertCountEqual�__all__)Z	test_caser�Zname_of_moduleZextraZ	blacklistZexpectedrvr�rdrdrer=�	s)


c@s(eZdZdZdZdZdd�Zdd�ZdS)rZz�Try to prevent a crash report from popping up.

    On Windows, don't display the Windows Error Reporting dialog.  On UNIX,
    disable the creation of coredump file.
    Nc
Csrtjjd�r�ddl}|jj|_d}|jj|�|_|jj|j|B�yddl	}|j
Wnttfk
rlYnLXi|_
x�|j|j|jgD].}|j
||j�}|j||j�}||f|j
|<q�Wn�tdk	�r
y*tjtj�|_tjtjd|jdf�Wnttfk
�rYnXtjdk�rnddd	d
g}tj|tjtjd�}|�|j�d}	WdQRX|	j�dk�rntd
ddd�|S)z�On Windows, disable Windows Error Reporting dialogs using
        SetErrorMode.

        On UNIX, try to save the previous core file size limit, then set
        soft limit to 0.
        r�rNr�rr�z/usr/bin/defaultsr^zcom.apple.CrashReporterZ
DialogType)r�r�s	developerz:this test triggers the Crash Reporter, that is intentionalr�T)�endr
) rorprqr�r�r��_k32�SetErrorMode�	old_value�msvcrt�CrtSetReportModer�rn�	old_modes�CRT_WARN�	CRT_ERROR�
CRT_ASSERTZCRTDBG_MODE_FILE�CrtSetReportFileZCRTDBG_FILE_STDERRr�Z	getrlimit�RLIMIT_CORE�	setrlimitr�r�rr�PIPEZcommunicaterar�)
rgr�ZSEM_NOGPFAULTERRORBOXr��report_type�old_mode�old_file�cmd�procr�rdrdrer�2
sN




zSuppressCrashReport.__enter__cGs�|jdkrdStjjd�rl|jj|j�|jr�ddl}xj|jj�D]$\}\}}|j	||�|j
||�qBWn6tdk	r�ytjtj
|j�Wnttfk
r�YnXdS)zARestore Windows ErrorMode or core file behavior to initial value.Nr�r)r�rorprqr�r�r�r�r�r�r�r�r�r�r�r�)rgr�r�r�r�r�rdrdrer�s
s
zSuppressCrashReport.__exit__)r`rarbrcr�r�r�r�rdrdrdrerZ)
s
Acsrt���d�y�j��Wn$ttfk
r@t��d��YnXd�����fdd�}|j|�t��|�dS)z�Override 'object_to_patch'.'attr_name' with 'new_value'.

    Also, add a cleanup procedure to 'test_instance' to restore
    'object_to_patch' value for 'attr_name'.
    The 'attr_name' should be a valid attribute for 'object_to_patch'.

    FNTcs �rt����n
t���dS)N)r�r[rd)�
attr_is_local�	attr_name�object_to_patchr�rdre�cleanup�
szpatch.<locals>.cleanup)r�rjr�r�Z
addCleanupr�)Z
test_instancer�r�Z	new_valuer�rd)r�r�r�r�re�patch�
s


r�cCsFyddl}Wntk
r YnX|j�r4tjd��ddl}|j|�S)zi
    Run code in a subinterpreter. Raise unittest.SkipTest if the tracemalloc
    module is enabled.
    rNzUrun_in_subinterp() cannot be used if tracemalloc module is tracing memory allocations)�tracemallocrnZ
is_tracingrsrtr��run_in_subinterp)r�r�r�rdrdrer��
s
r�csHG��fdd�d|�}d�|||���|jtt��t�|j��dS)NcseZdZ��fdd�ZdS)z%check_free_after_iterating.<locals>.Acs*d�yt��Wntk
r$YnXdS)NT)�next�
StopIteration)rg)�done�itrdre�__del__�
s
z-check_free_after_iterating.<locals>.A.__del__N)r`rarbr�rd)r�r�rdre�A�
sr�F)rLr�r�r�Z
assertTrue)r�r�rCr�r�rd)r�r�re�check_free_after_iterating�
s	r�cCs|ddlm}m}m}|j�}|j|�xP|jD]F}|r@||kr@q.t||�}|rPn
|dkrZq.|j|d�dkr.|dSq.WdS)a<Check if the compiler components used to build the interpreter exist.

    Check for the existence of the compiler executables whose names are listed
    in 'cmd_names' or all the compiler executables when 'cmd_names' is empty
    and return the first missing executable or None when none is found
    missing.

    r)�	ccompilerr��spawnN)	Z	distutilsr�r�r�Znew_compilerZcustomize_compilerZexecutablesr�Zfind_executable)Z	cmd_namesr�r�r�Zcompilerrvr�rdrdrer^�
s	

cCs@d}tr6||kr6tdkr.tjddg�j�dkatr6|}tj|�S)Ng�h㈵��>Zgetpropzro.kernel.qemu�1)rA�_is_android_emulatorrZcheck_outputrarorD)ZintervalZminimum_intervalrdrdrerD�
sc
cs>tjj�}tj�}ztj�dVWd|r8tj|dd�XdS)NT)r�Zall_threads)ror�rGrZ�
is_enabledr�r�)rAr�rdrdre�disable_faulthandler�
s

r�c	/Cs�tjjd�r8ytjd�}t|�dStk
r6YnXd}ttd�rjytjd�}Wnt	k
rhYnXd}tjd	kr�yd
dl
}|jWntt
fk
r�Yn0Xi}x(|j|j|jfD]}|j|d
�||<q�Wzpd
}xft|�D]Z}ytj|�}Wn4t	k
�r(}z|jtjk�r�WYdd}~Xq�Xtj|�|d7}q�WWd|dk	�rzx*|j|j|jfD]}|j|||��q`WX|S)z/Count the number of open file descriptors.
    �linux�freebsdz
/proc/self/fdr��sysconf�SC_OPEN_MAXNrr)r�r�)rorprqr�r�r�r�r�r�r�r�r�r�rnr�r�r�rO�dupr�ZEBADFr)	�namesZMAXFDr�r�r�rPrAZfd2r�rdrdrer_	sP





c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�SaveSignalsz�
    Save an restore signal handlers.

    This class is only able to save/restore signal handlers registered
    by the Python signal module: see bpo-13285 for "external" signal
    handlers.
    cCsjddl}||_ttd|j��|_x>dD]6}yt||�}Wntk
rNw&YnX|jj|�q&Wi|_dS)Nrr�SIGKILL�SIGSTOP)r�r�)	�signalr|rO�NSIG�signalsr�r�rzrf)rgr�Zsigname�signumrdrdrerhMs
zSaveSignals.__init__cCs4x.|jD]$}|jj|�}|dkr"q||j|<qWdS)N)r�r��	getsignalrf)rgr��handlerrdrdre�saveZs
zSaveSignals.savecCs*x$|jj�D]\}}|jj||�qWdS)N)rfr�r�)rgr�r�rdrdre�restorefszSaveSignals.restoreN)r`rarbrcrhr�r�rdrdrdrer�Ds
r�c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�FakePathz.Simple implementing of the path protocol.
    cCs
||_dS)N)r�)rgr�rdrdrerhnszFakePath.__init__cCsd|j�d�S)Nz
<FakePath �>)r�)rgrdrdre�__repr__qszFakePath.__repr__cCs6t|jt�s$t|jt�r,t|jt�r,|j�n|jSdS)N)r�r��
BaseExceptionr�ry)rgrdrdre�
__fspath__ts
zFakePath.__fspath__N)r`rarbrcrhr�r�rdrdrdrer�ksr�ccs.tj�}ztj|�dVWdtj|�XdS)z>Temporarily change the integer string conversion length limit.N)ro�get_int_max_str_digits�set_int_max_str_digits)Z
max_digitsZcurrentrdrdre�adjust_int_max_str_digits|s


r�)T)F)F)N)Nii@i@i@ii)rrrrrrrrr r!r")r&r$r'r(r))NF)F)r6F)N)Fi@ii)T)N)Nr)rR)N(rcr`rn�collections.abc�collections�
contextlibZdatetimer�rZr?r�r�r�rm�importlib.utilr�Zlogging.handlersrer�r�rprvr�rr�r�rror�r+r�r�rsZurllib.errorr`rgZ
testresultrrJrLZmultiprocessing.processr&�zlibrW�bz2Zlzmar�r�r�r�r	r
rrtr�contextmanagerrkr
rr�r:r;rr6rrrrr0rr�rrrr�rqr�r�r�r�r�rr�rr�rr�r r!r�r"r#r$r%rErr	r
rGrHrJrrFrrZ
SOCK_MAX_SIZEZ
skipUnlessr�
__getformat__r7r9r0r1r2r@r�rrArCrvrr�r/ZFS_NONASCII�	character�fsdecode�fsencode�UnicodeErrorZTESTFN_UNICODEZunicodedata�	normalize�getfilesystemencodingZTESTFN_ENCODINGZTESTFN_UNENCODABLEZgetwindowsversion�encode�UnicodeEncodeErrorr��decode�UnicodeDecodeErrorZTESTFN_UNDECODABLEZTESTFN_NONASCIIr3rr]r}r2r5rr�rKr�r�r�r�ZTEST_SUPPORT_DIRr:r�r\rrr[rHr&rI�objectrdr�rRr�r�rSr�abc�MutableMappingrTr�r'r�r�r(r�r)r*r+r�rrrr�r�r�r�r�r�r�r�r�r�r�rUr\r�r�rZ_4GrrrYr	r3r4r,rrr>r5r!r%r?r"rBr*r+r-r2r3r<r5r7rAr-rDZMISSING_C_DOCSTRINGSZHAVE_DOCSTRINGSZrequires_docstringsr.rHrIZenvironment_alteredrNrOrPrTrLrQrWrVrbZskipIfZrequires_type_collectingrcrdrfrgrMrXrrrr/rzr|r8r~rr<r=rZr�r�r�r^r�rDr�r_r�r�r�rdrdrdre�<module>s�











2	
!

J			>%	


%2' 5M		



$
#
0







(




"
#
	"
:_";'support/testresult.py000064400000015015150327172730011061 0ustar00'''Test runner and result class for the regression test suite.

'''

import functools
import io
import sys
import time
import traceback
import unittest

import xml.etree.ElementTree as ET

from datetime import datetime

class RegressionTestResult(unittest.TextTestResult):
    separator1 = '=' * 70 + '\n'
    separator2 = '-' * 70 + '\n'

    def __init__(self, stream, descriptions, verbosity):
        super().__init__(stream=stream, descriptions=descriptions, verbosity=0)
        self.buffer = True
        self.__suite = ET.Element('testsuite')
        self.__suite.set('start', datetime.utcnow().isoformat(' '))

        self.__e = None
        self.__start_time = None
        self.__results = []
        self.__verbose = bool(verbosity)

    @classmethod
    def __getId(cls, test):
        try:
            test_id = test.id
        except AttributeError:
            return str(test)
        try:
            return test_id()
        except TypeError:
            return str(test_id)
        return repr(test)

    def startTest(self, test):
        super().startTest(test)
        self.__e = e = ET.SubElement(self.__suite, 'testcase')
        self.__start_time = time.perf_counter()
        if self.__verbose:
            self.stream.write(f'{self.getDescription(test)} ... ')
            self.stream.flush()

    def _add_result(self, test, capture=False, **args):
        e = self.__e
        self.__e = None
        if e is None:
            return
        e.set('name', args.pop('name', self.__getId(test)))
        e.set('status', args.pop('status', 'run'))
        e.set('result', args.pop('result', 'completed'))
        if self.__start_time:
            e.set('time', f'{time.perf_counter() - self.__start_time:0.6f}')

        if capture:
            if self._stdout_buffer is not None:
                stdout = self._stdout_buffer.getvalue().rstrip()
                ET.SubElement(e, 'system-out').text = stdout
            if self._stderr_buffer is not None:
                stderr = self._stderr_buffer.getvalue().rstrip()
                ET.SubElement(e, 'system-err').text = stderr

        for k, v in args.items():
            if not k or not v:
                continue
            e2 = ET.SubElement(e, k)
            if hasattr(v, 'items'):
                for k2, v2 in v.items():
                    if k2:
                        e2.set(k2, str(v2))
                    else:
                        e2.text = str(v2)
            else:
                e2.text = str(v)

    def __write(self, c, word):
        if self.__verbose:
            self.stream.write(f'{word}\n')

    @classmethod
    def __makeErrorDict(cls, err_type, err_value, err_tb):
        if isinstance(err_type, type):
            if err_type.__module__ == 'builtins':
                typename = err_type.__name__
            else:
                typename = f'{err_type.__module__}.{err_type.__name__}'
        else:
            typename = repr(err_type)

        msg = traceback.format_exception(err_type, err_value, None)
        tb = traceback.format_exception(err_type, err_value, err_tb)

        return {
            'type': typename,
            'message': ''.join(msg),
            '': ''.join(tb),
        }

    def addError(self, test, err):
        self._add_result(test, True, error=self.__makeErrorDict(*err))
        super().addError(test, err)
        self.__write('E', 'ERROR')

    def addExpectedFailure(self, test, err):
        self._add_result(test, True, output=self.__makeErrorDict(*err))
        super().addExpectedFailure(test, err)
        self.__write('x', 'expected failure')

    def addFailure(self, test, err):
        self._add_result(test, True, failure=self.__makeErrorDict(*err))
        super().addFailure(test, err)
        self.__write('F', 'FAIL')

    def addSkip(self, test, reason):
        self._add_result(test, skipped=reason)
        super().addSkip(test, reason)
        self.__write('S', f'skipped {reason!r}')

    def addSuccess(self, test):
        self._add_result(test)
        super().addSuccess(test)
        self.__write('.', 'ok')

    def addUnexpectedSuccess(self, test):
        self._add_result(test, outcome='UNEXPECTED_SUCCESS')
        super().addUnexpectedSuccess(test)
        self.__write('u', 'unexpected success')

    def printErrors(self):
        if self.__verbose:
            self.stream.write('\n')
        self.printErrorList('ERROR', self.errors)
        self.printErrorList('FAIL', self.failures)

    def printErrorList(self, flavor, errors):
        for test, err in errors:
            self.stream.write(self.separator1)
            self.stream.write(f'{flavor}: {self.getDescription(test)}\n')
            self.stream.write(self.separator2)
            self.stream.write('%s\n' % err)

    def get_xml_element(self):
        e = self.__suite
        e.set('tests', str(self.testsRun))
        e.set('errors', str(len(self.errors)))
        e.set('failures', str(len(self.failures)))
        return e

class QuietRegressionTestRunner:
    def __init__(self, stream, buffer=False):
        self.result = RegressionTestResult(stream, None, 0)
        self.result.buffer = buffer

    def run(self, test):
        test(self.result)
        return self.result

def get_test_runner_class(verbosity, buffer=False):
    if verbosity:
        return functools.partial(unittest.TextTestRunner,
                                 resultclass=RegressionTestResult,
                                 buffer=buffer,
                                 verbosity=verbosity)
    return functools.partial(QuietRegressionTestRunner, buffer=buffer)

def get_test_runner(stream, verbosity, capture_output=False):
    return get_test_runner_class(verbosity, capture_output)(stream)

if __name__ == '__main__':
    class TestTests(unittest.TestCase):
        def test_pass(self):
            pass

        def test_pass_slow(self):
            time.sleep(1.0)

        def test_fail(self):
            print('stdout', file=sys.stdout)
            print('stderr', file=sys.stderr)
            self.fail('failure message')

        def test_error(self):
            print('stdout', file=sys.stdout)
            print('stderr', file=sys.stderr)
            raise RuntimeError('error message')

    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(TestTests))
    stream = io.StringIO()
    runner_cls = get_test_runner_class(sum(a == '-v' for a in sys.argv))
    runner = runner_cls(sys.stdout)
    result = runner.run(suite)
    print('Output:', stream.getvalue())
    print('XML: ', end='')
    for s in ET.tostringlist(result.get_xml_element()):
        print(s.decode(), end='')
    print()
usr/bin/test000075500000153200150334356010007033 0ustar00ELF>�@��@8@@@@hh���x�x� ���� �� �h �� � �����  ���DDS�td���  P�td<�<�<���Q�tdR�td���� �� pp/lib64/ld-linux-x86-64.so.2GNU�GNUGNU`m�	'�g��"�V����B��o|��1~ ����"�A��bQ)9������� ����4C~]tK*):��� ;�k�"Ohlibc.so.6fflush__printf_chksetlocalembrtowcstrncmpstrrchrdcgettexterror__stack_chk_fail__lxstatiswprintreallocabort_exitprogram_invocation_nameerror_at_line__ctype_get_mb_cur_maxstrtolisattycallocstrlenmemset__errno_locationmemcmp__fprintf_chkstdoutlseekmemcpyfcloseeuidaccessmallocmbsinitnl_langinfo__ctype_b_loc__freadingstderr__snprintf_chkgetegidfilenofwritegeteuid__fpendingprogram_invocation_short_name__cxa_finalize__xstatbindtextdomainstrcmp__libc_start_mainfseekofputs_unlockedfree__progname__progname_full__cxa_atexitGLIBC_2.3GLIBC_2.14GLIBC_2.4GLIBC_2.3.4GLIBC_2.2.5_ITM_deregisterTMCloneTable__gmon_start___ITM_registerTMCloneTableii
G���Qii
\ti	fui	r�� ��� p�� �� �� 1�Ȼ 9�л ?�ػ L�� Y�� m�� o��� R�� ��� w�`� p� x� �� �� �� 	�� �� ȿ "п 5ؿ 7� 9� ; � (� 0� 8� @� H� P� 
X� `� h� 
p� x� �� �� �� �� �� �� �� �� �� Ⱦ о ؾ � � �  �� !� #� $� %� & � '(� (0� )8� *@� +H� ,P� -X� /`� 0h� 1p� 2x� 3�� 4�� 6�� 8�� 9�� :��H��H�I� H��t��H����5z� �%{� ��h�������h��������h�������h�������h�������h�������h�������h��q������h��a������h	��Q������h
��A������h��1������h��!������h
��������h��������h������h�������h��������h�������h�������h�������h�������h�������h��q������h��a������h��Q������h��A������h��1������h��!������h��������h��������h������h �������h!��������h"�������h#�������h$�������h%�������h&�������h'��q������h(��a������h)��Q������h*��A������h+��1������h,��!������h-��������h.��������h/������h0��������%e� D���%]� D���%U� D���%M� D���%E� D���%=� D���%5� D���%-� D���%%� D���%� D���%� D���%
� D���%� D���%�� D���%�� D���%� D���%� D���%ݦ D���%զ D���%ͦ D���%Ŧ D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%}� D���%u� D���%m� D���%e� D���%]� D���%U� D���%M� D���%E� D���%=� D���%5� D���%-� D���%%� D���%� D���%� D���%
� D���%� D���%�� D���%�� D���%� D���%� D�����������������������������UH��S��H��H�>�9H�5Yk�����H�5[kH�=Fk�5���H�=:k�	���H�ƥ H�=���@iH�-1� �3� �-� ��~$�{���Hc� ;� u����H��[]ø��H�� H�<��;H�5�j1��H�����H��H��1��ffD��1�I��^H��H���PTL��hH�
hH�=������� �H�=y� H�r� H9�tH��� H��t	�����H�=I� H�5B� H)�H��H��H��?H�H�tH�u� H��t��fD�����=� u+UH�=Z� H��tH�=� �	����d����ݤ ]������w����SH���H�=�gH�޸��€���t�H�=�gH����€���u	[���H�=�gH����€���tܹH�=�gH����€���t��H�=�gH����€���t��H�=mgH����€���t��H�=VgH����€����l����H�=;gH����€����M����H�= gH����€����.����H�=gH����€�������H�5�fH���A����¸����H��H�5�f�#���[�����ff.��PXH���H�t$(H�T$0H�L$8L�D$@L�L$H��t7)D$P)L$`)T$p)�$�)�$�)�$�)�$�)�$�dH�%(H�D$1�H��$�H��H��H�D$1�H�D$ 1��$�D$0H�D$�;��t���@SH������L�H���H��A�Hut��+t1ɀ�-��H��1H�Q��0��	wn�q���0��	w�H���2���0��	v���A�ptDH���2H��A�pu��u$[�f�H���v����H�HH���H���7H�5Ve1��H������H��H��1��|���ff.��Hcɡ H��� SH�|��w7H�5!e1��H�����H��H��1��4���@��� �P;�� �� }
���t� �P���f�USH��HcT� dH�%(H��$�1�H�.� H���@��G<3wH�0f��Hc�H�>��1�fDH��$�dH3%(���GH�Ĩ[]�D�K���Hcؠ H�Š H�D��8����+���Hc�� �H��� H�|��>������������Hc�� �H�p� H�|����������\���@����Hc
X� H��H�B� �H�t��+���1҅��)����T$��������f����Hc� H�� H�|��S���H���K����
1�H���H�����1҃;"����H=����������e�����������#���Hc
�� H��H��� �H�t����1҅������H�|$0���s������Hcp� �H�X� H�|���������D���@���Hc
@� H��H�*� �H�t�����1҅������D$%�=������k���Hc�� H�� H�D��8������D�C���Hc
О H��H��� �H�t����1҅�������T$��	�����f.����Hc
�� H��H�r� �H�t��[���1҅��Y����T$��
���J���f����Hc
H� H��H�2� �H�t�����1҅������D$%�=��������s���Hc
� H��H�� �H�t�����1҅������D$%�=@������+���Hc
�� H��H��� �H�t����1҅�������D$%�= ���s������Hc
p� H��H�Z� �H�t��C���1҅��A����D$%�=`���+������Hc
(� H��H�� �H�t�����������k���Hc
�� H��H�� �H�t����1҅������D$%�=�������#���Hc
�� H��H��� �H�t�����{�������H���������9D$���[�������Hc
X� H��H�B� �H�t��K�1҅��)����D$%�=����������Hc
� H��H��� �H�t����������6��H������t9D$ ������31҅�������G����1҅�����������AU��ATUSH��h�
�� dH�%(H��$X1ۍQ@��t	�n� �Q�=a� H�R� Hc�E1�O�9�~!H�t��H�=�^���������H�4�L�,����-����=���H�=3^������ �Hc� H��H��H�4�H�|�����A�ă��-ɚ H��$XdH3%(D���;H��h[]A\A]�D��� A��[�����F��t<=�e����~�[���fDHc]� H��H��H�4�H�|������A�ă��-9� �k����V��l�[��g�R��e����n���o���~t���~���� A���H��$�J�t+��H����J�L+����H�1H��L��$�H��$��������H��$�H��$�L9��:)��L9�DM����f��V��q�p��f�+�~�!�=� A���J�t+�H������Q���J�t+H��$�������2���H��$�H9$� ���H��$�H9D$A���
�����N��et	��t������~����n�������tu�~uy��� A��H��$�J�t+��H���^�J�L+���!H�1H��L��$�H��$��1���1A��i���fD��e�wH����-H�5�[1��H�����H��H��1���@�N��e�@����~u�J�|+�������H��$ H���H��H��� E����J�|(��H��$@H����H��H���S-H�t� H��ye�I�ƒj� ��l����g������8�A������@H�1H��� ��f���H�1H������A���H���DH��$�L;�$��-���A��!���)Å�A������f�J�|(��H���3���fD��H�����V�L������9�A������f.����9�A��������H�5�Y1��8�1�H��1����H�5�Y�ߺH�5�Y���O1���G��3wH����{�H��H�����f�Hc�� L�
� �H�=�YM��H��L��L�������t)SA�8-u7A�xt0A�xu)L���|�����t"[�B�f�K�D����� �8������A+H�5hY1��H���K�H��H��1���ff.�H������~q��������Hc,� L�
� �H�=YM��H��L��L����€�������;� �� ������H��Ð��u+HcȔ �P��� H��� H�€8��H���D��� ;�� }|H���|@H����H���o�����H�=fXL����€���u�K�t�H�=o��€���u����+� �"����� �@����A�AWAVAUATUSH���� D�-�� �D$�D$D9���f�L�ѓ Lc�O�<�E�'A��!��A�������� D9��dLc�1���&A��UI����E9������O�<�D��D��A�7@��!tɄ�tD�5Z� A��A��(�A���S�9� D9����CD9��pH�E�M�M��A)ٸI�2�H�=�m�������t������I��A9�u�fD�����Hc
Β H��� H�4�H��H���_�>)��~���D�-�� ��� 1� D$A9���H�r� HcùH�=�VH��H��������5���P� D9��c����n�fD��tD�51� D��)؃����L��H�=�U�����uK�|�L�$�'�L�$���K�|�������A��-tKE������1�Ƒ  D$A9��4����D$D$�D$H��[]A\A]A^A_��t�A��-u�A�t�A�u�L���B������E��c� D�-X� ����D��)��n���fD1�����7� D�-,� �����H�=EUH���D$D$������M������� �����>����ܐ D�-ѐ �<���@1��n����1����f������fD�
�� �����;&H�5]k1�H���*&�H�5�T1�H���D�H��H��H��1����H�=&k�&�H�5HTH��1���H��H��1������%�H�5TH����ff.�@AUATUSH��Hc� H�-� H��H��L�l�L�$�L��������J�T%��H�=�SH�������u-��;�� ��� �������H��[]A\A]�D�H�=vSH�������u6J�t%�H�=&j�����uA�}�����5� ���H�=JSL�������t�H�=3SL�������u-;� }PH��[]A\A]����DH��1�[]A\A]�'�L���$H�5�R1��H����H��H��1��<�������ATU��SH�ĀdH�%(H�D$x1���t@H�� �H�5;T1�H��1��H��H��� H��H�81��������H�G� �1�H�5!TL�#���H��L����L�#�1�H�5UT���L��H���u�L�#�1�H�5lT��L��H���T�L�#�1�H�5{T��L��H���3�L�#�1�H�5�T�m�L��H����L�#�1�H�5�T�L�L��H�����L�#�1�H�5�U�+�L��H�����L�#�1�H�5�V�
�L��H����L�#�1�H�5�W���L��H����L�#�1�H�5�X���L��H���m�L�#�1�H�5,Y��L��H���L�L�#�1�H�5#Z��L��H���+�L�#�1�H�5*[�e�L��H���
�L�#�1�H�5)\�D�L��H�����L�#�1�H�5�\�#�L��H�����H��1�H�5O]��H��H�����H�5aP1�����H�5�]1�H�����H�ڿH�0PH��1��E�H�0PH�
jPH�D$`H�$H�PH�D$H��PH�L$0H�
HPH�D$H�PH�L$@H�
:PH�D$H�PH�L$PH�D$hH�D$ H��OH�D$(H�D$8H�D$HH�D$XH��fDH��H�8H��t�H����€���u�L�`�H�5�O1�M��������H�
d]H��OH��1��S�1���7�H��t�H�5�OH���.����1��H�5�]��H�
�N�H�]H��1���I9�H�
SOH��NHE�1�H�5h]��>�H��L��H��1����������H�
�\H�OH��1���1���v�H��t�H�5�NH���m���uC�H�5�\1����H�
0NH�H\�H��1�L�%N�2�H�9N�E���L�%N1��H�59\�|�H��M�H��1����������H�=�� �@��@�=m� �@��USH��H�o� H�8�7(��t����=?� H��t�8 uH�~� H�8�(��uFH��[]�1��H�58\����H�=	� H��H��t+��3I��1�H��H�\1��T�H�A� �8�F���3H��H��[1�1��1���f.�D��H�N�FH�����������H��H��I��H��H��H��H��H�I)�L����0�H��	w�H�����SH�����/H���u��H��tXL�@L��H)�H��~HH�p��H�=�[��€���u,�H�=�[L��L����€���uH�XH�#� H�H�� H�H��� H�[�H�� �7�H�=�ZH��r�����f.�UH��S��H���@'���߀�UuM�P��߀�Tu^�P��߀�FuR�x-uL�x8uF�xu@�}`H��ZH��ZHE�H��[]�fD��Gu�P��߀�Bu�x1u�x8t#��	H��ZH��ZHE�H��[]���x0u׀x3uрx0uˀxuŀ}`H�\ZH�NZHE�H��[]�AWAVI��AUATI��UH��SD��H���H��$H�T$D�D$H�D$ H��$D��$�H�D$hH��$H�D$`dH�%(H��$�1��2��D�\$��H�D$X�D$CA��
�[��H�
ZD��Hc�H�>���D$AE1�Ƅ$�H�D$P�D$C�D$BH�}YE1�A�H�D$H�D$HE1�D��E��I��L��A���I9�A��I���u
H�D$�<(A��E����A��H�|$��"D$BL�/�D$��H�D$H���1H�\I���u-H��v'D�T$8D�D$0L�L$(�D��D�T$8D�D$0L�L$(I��L9���H�T$H�t$HL��D�T$DL�\$8D�D$0L�L$(���L�L$(D�D$0��L�\$8D�T$D���|$C��A���~��H�
�X��Hc�H�>��f��D$I����I���uH�D$�x��A��������H�����|$Ct�����T$B����FH�t$ H��t�ډ���ҋ����u�|$�5A���€|$C���kD���� �t/M9�vC�>'I�WI9�vC�D>$I�WI9�vC�D>'I��A��M9�sC�>\I��H��M9�sC�>�|$AI���E��D�@�|$A��f��D$A����A����A���?��E1������D$A���1D��$�1��'���D�D$�\$C�\$BtH�|$�q�\�\f��|$B�E1�1��|$C������|$������H��D!��C�D$1�E1��q���f��rE1�A���€|$C�������@ D$BL��E�Ӏ|$B�DE�H��E��H��t$hL��L���t$xjD��$�H�T$0A�����H�� I��H��$�dH3%(L���:H���[]A\A]A^A_�D�fA�����|$C�i���E1��/�����n�;���fD�D$�	�t����@�b붐�a�f��|$C�!
�D$A��D���ƒ� ���M9�vC�>'I�OI9�vC�D>$I�OI9�vC�D>'I�OI9��@A�\A��L�yA���q
H�E�0L9�sH�D$�D(�D$(��0<	��	�D$B���D��A���������D$H�|$X�wD�T$8L�\$0D�D$(�����D�D$(L�\$0H�D�T$8��Pf%@A����"T$B���*A�����I����A���~w�H�
�V��Hc�H�>���
�rA����"T$C�T$�Q���L��A������v�1������f�!�����
�n�@�	�t�@��b�����a�����|$B�%����D$1��$�����H�������A��������|$C�~
H��D��E1�\@������M9�vC�>'I�GI9�vC�D>'I��E1����A����E1����f�A��� �������A�������@A���~����H�
8W��Hc�H�>���1�D�l$�D$1����D1�H����D�l$�D$1��t���@1�� ��A��E��L����M��u
�T$C�h
�D$C�� ��w	��$��g	�|$A�
M����H�|$P�� ���	L�d$PA�'H��QA�A�H�\$HH�D$�D$C��$��`�����|$C��M���P1�H�|$P�BL�d$PI��1�E1�D��$�I�Ի'�����$�tH�EL9�sH�\$�|+?��D1�E1�?�I�����|$C�hE1�1��?�\���fDH��$�HDŽ$�H�D$pI���u,H�|$D�T$8D�D$0L�L$(�X��D�T$8D�D$0L�L$(I��1�H��$���$�L�t$xH��L�t$pH�D$8D��$�H�l$0L��$�L��$�L��$�L�\$(D�T$D�+���$�����L�����DD�H�������hH�D$0H�T$(L��H�|$8L�<H�D$L)�N�$8L���lH��H���2H����H����V�|$Du��|$C�z���H���p���H�|$H�4/J�D?L��DH��H9��K������[��!w�H�+�H��H��t�L�t$xL��$�A�H�l$(�V���@�D$E1�1����f.�L��M9��f���D���V���M9�vC�>'I�GI9�vC�D>\I�GI9���L��C�D>'L�d$P����T$BE1�H��D�l$(1�D�l$CH��|$L�L$�f�A����E���D�ƃ�@ �t/M9�vC�>'I�wI9�vC�D>$I�wI9�vC�D>'I��A��M9�vC�>\I�GI9�v
�����0C�D>I�GI9�v�������0C�D>��H��I����0H9��V��M9�vC�>A�)I�����J������D!�@��tM9�vC�>\I��H��H9�s,���M9�vC�>'I�GI9�vC�D>'I��1�E1��D�l$(���L�݈D$BE������v�k���I��A��E1�0��������D$BM����H��M�D$AE1�A�H�D$PA�Ƅ$��D$CH�D$H�D$H����CM����A�"E1��D$AƄ$�H�D$PH�&M�D$CA��D$BH�D$H�D$H��A��
tjH�5M1��D�\$�2��D�\$H��H�D$hH��LH9��uH�5�L1��D�\$���D�\$H��H�D$`H��LH9��$E1����JH�\$`D�\$E1�H������H�\$HD�\$H�D$�D$AƄ$�H�D$P�D$B���H�=L�D$AE1�E1�Ƅ$�A�H�D$P�D$C�D$BH�D$H�D$H���D$AE1�E1�Ƅ$�H�D$P�D$C�D$BH�D$H�D$H�]��D$AE1�E1�Ƅ$�H�D$P�D$C�D$BH�D$H�D$H� ��D$AE1�Ƅ$�H�D$P�D$C�D$B����D$����D$����D$����M9�vC�>0H�AI9�vA�D0L�y�0�K������t�D$B�]���f�D�l$(��1����H��D��H�l$0L�t$x��$�L�\$(��D��$�L��$�L��$�D�T$D"T$BH��������H���H�D$PE1��D$AƄ$��U���D��0E1������>����H���pH��������|$C��M9�vC�>?I�WI9�vC�D>"I�WI9�vC�D>"I�WI9�vC�D>?I��1�E1�H���2���H��H�l$0L�t$xE1�D��$���$�L��$�L��$�L�\$(D�T$D�T$B�
���L�\$(L��L��H��H��H�l$0D��$���$�L��$�L��$�L�t$xL��$�D�T$DL9�s �>u
��A�<tH��H�TI9�w�H���T$BE1����H�T$h��������M9�vC�>I��B�:��u����H�	I�D$AE1�E1�Ƅ$�H�D$P�D$C�D$BH�D$H�D$H�l�L��E����L��E�����H�\$HH��t,��t(�H�؄�tL��L)�I9�vA�H�����u�I��M9����C�>�{�H�|$`D���?�D�\$H�D$`���H�|$hD���#�D�\$H�D$h�o���A��L��E���D$B�����$��^���H��A�H��L���t$h�t$x�t$8D��$�H�T$0H�t$p��H�� I�����A���E1��D$A1�H�D$P���L��L�d$P�������B��(��H��G�D$AE1�E1�Ƅ$�H�D$P�D$C�D$BH�D$H�D$H���AWLc�AVI��AUATUH��SH��(H�t$����H�hs I�ŋ�D$E������D9=Gs bA������QE�gH�Es Ic�H��H9��H����H�s H��Hc=s D��1�)�H��Hc�H�H�����D�%�r �EI��H��D�EL�L�}L���L�L�c�D$$A���u0L��L��u(AWH�T$(L�\$0�$�H�� L�\$I9�wgH�pH��r H�3I9�tL��H�t$����H�t$H��H�t$�H��L��H�CD�EH��I��u0�u(AWD�L$<H�T$(H�t$0��H�� �D$A�EH��(L��[]A\A]A^A_�D1��for H��H��q �����
f.���ATUSH���P��H�۾8D� H��H�s HD�H���
D�e[]A\�fD��H��H��r HD���ff.���H��H��r HD��7�ff.���H��H��r ��HD��������H�|��7����1ƒ�����1�����H��H�rr HD��G�w����H��H�Rr HD��
H��tH��t	H�w(H�W0�P�?��ff.�@��AWH�r I��AVI��AUI��ATUSL��H��M��HD�H�L$�
��H��L��L��D� H��H�CD�K�s0L��s(PD�H�L$(���D�eH��8[]A\A]A^A_����AWH��q I��AVI��AUATI��USH��H��8H��HD�1����M��L��L��I�ŋ@��L�SH��k1�1��D$A��s0�s(ARD�L�T$@�P�H�pH�D$HH�� H��H�t$�	A��L��L��H�D$H��H��s0�s(L�T$8ARH�t$8D����D$,H�� A�EM��t	L�\$(M�$H�D$H��8[]A\A]A^A_�f���H��1�����f����.o ATL�%-o US��~'��I�\$H��I�l(DH�;H���d��H9�u�I�|$H�So H9�t�I��H��n H��n H��n I9�tL���#��H��n ��n []A\�ff.�f���H�
�o H��������f���H�
�o �����H��1�����f���H��H��1�����ff.�@��H��HH��dH�%(H�T$81҃�
�����4$H��H��H������D$H�D$H�D$H�D$H�D$ H�D$(H�D$0�9���H�L$8dH3%(uH��H����ff.�@��H��HH��H��dH�%(H�L$81Ƀ�
�����4$H��H���D$H�D$H�D$H�D$H�D$ H�D$(H�D$0���H�T$8dH3%(uH��H��c����H��1������H��H��1��M���ff.�f���ATI����UH��SH��@fon fo
&n dH�%(H�D$81�fon H�'n H��H��)$)L$)T$ H�D$0����H��1�L��H������H�L$8dH3%(u	H��@[]A\����ff.���@��H������L���ff.�����:����f����:�"���f���ATUSH��@dH�%(H�D$81���
�T��H��I�ԉ4$��:H���D$H�D$H�D$H�D$H�D$ H�D$(H�D$0� ���H��L���H���������H�L$8dH3%(u	H��@[]A\����ff.���AUM��ATI��U��SH��Hfo�l fo
�l dH�%(H�D$81�fo�l H��l H��H��)$)L$)T$ H�D$0����H��L��L����=���H�L$8dH3%(uH��H[]A\A]����ff.�f���I������P�����H��H��H��1�����ff.����I��H��H��H��1�����f���H�
j �����H��H��1�����ff.�@��H����������H��1����f�������-����-��@��0����0����D�@�8�u#A��	��H��H����D�@�8�t�)�A��	��E1��B�LI����0��	v��0��	��1��TH����0��	v�I9��N����H���<0t�D��E�HЀ�-thA��	�ZfD��0���01���	����ÐH���<0t��Pи��	w��H�����0t��01���	����H�����0t�8�u"A��	�H��H��D��E�H�A8�t��ʉ�D)�A��	��E1�f�B�TI����0��	v�QЃ�	��1��TH����0��	v�L9�tRI9�������fDH����U���@H����<���@H������@M���D��@H�ɺD��@1�M�����1�M������ø�����fD)Ѓ�0E1���	�E���1��@�ʉ�D)��Q�E1���	�7��������AVA��AUA��L��ATA��L��UH��S�H��t_H��H��t0D��I��D��H��D��L��:1��ӽ��H��[]A\A]A^铽��D��H��D��1�H��:�ɿ��H��[]A\A]A^�i����H�5eA1�����H���n���H��1��01�萿���K���ff.���I��I��1�1��-���f.���SH���Ӿ��H��uH��u[��Rf���H��H��H����H��x
��H��u���P�(���������SH��H��uH��uH��趾��H��uH��u[�f.��{���1�[���f���H��H��H����H��x
��H��u���P����I��H�H��t1H�TUUUUUUU1�I��H9�v8H��H��H�LH�I��H���S���H��t#H��I������H��xH��t�P�?�1Ҹ�E1�I��I���A��I��f.���H�H��t,H�SUUUUUUUH9�w7H��H��H�DH�H�������H��u��H�H�����y�P����SH���3���H��1�H���f���[�@��H��H��H����H��x��H��u�}���H��tH����^ff.���UH��H��SH��H������H��H��H���j���H��[]���SH��胻��H��[H�p���fD��PX�H�5�>1�H���3���H��c 1�H��1��:H�7跼���r���f�AWAVAUATUSH��(dH�%(H�D$1��o$L�~L�|$H����I��I��H��1�I������$@�ƒ��$L�H�:�ͺ��H�IB�H��t �$��/v�H�T$H�BH�D$���H�������H�{���H��H���5f��ƒ�IT$A�$L�:L���g���H��L��I��H���&���L�I��t-A�$��/v�I�T$H�BI�D$��@��F���H��H���H�L$dH3%(H��u!H��([]A\A]A^A_��C���1��K������@��H��dH�%(H�D$1����twI��<%u2�su,1��
��%u#A�|xsuH��A�x��u��a�����H��H��L������xH�$H�T$dH3%(uH���D裸���8t
1���1���a�������f.�f���AUI��ATI��USH��H��dH�%(H�D$1�H��H�D$HD�H���%���H��H���vM��u'H�T$dH3%(H��u-H��[]A\A]�f�1����u�A�E����¸��f���SH��H��1�H��dH�%(H�L$1�H��H��H���H��tBH�$H�����wH���H�\$dH3%(u'H��[�H���l���臷���K������и�������>���f.�@��ATUH��S萷���]H��I�ă� ����u#��tM��u0�-����8	������[]A\�D��u�����������������f.����H��1���H�¸H��t�H�=�:H�������1���uH���f��H�=�:H���������H�����H����N���H��t�8H��:HD�H���fDH�z:H���@��ATUSH���з��H�߅�xX�$�����u0H���h��t@����H��D� H��聶��E��u<[]A\��H��舷��1�������H���u�H��[]A\�H����D�e������D��SH��H��t螷����t�uH��[�Y���f�H�ߺ1��H��[�8������H�GH9Gt
靷��DH�G H9G(u�H�Hu�ATA��UH��SH���Ŷ��D��H����(���H���t�#�H���1�[]A\Ð��UH��AWAVL��P���AUATI��SH��L��H��H��8���H��H����H��@���dH�%(H�E�1�L���H����������L��L���k����
H��P���H�����H��H��HF�H�X�����H��E1�H��A����H�����L��0���H��������H�����H���uH�����L��0���E1�H��8���t
H����L� L��H���L��8���H��D���M��I��H�����I�L��HDž���L9��L)�L��H�I���I9�sgM���H���A�H;�8�����H���)���!L��H��L��(���H��0����`���H����H��0���L��(���H��J�<;H��L��跴��H�����H9�@����+A�VHI�FP��%��H����
���L��X���H��L��8��(�����n�H�����A�FL�y�%�tH������G'L��tA�-I���tA�+I���tA� I���tA�#I���@tA�II��� tA�0I��I�vI�V H9�t0H��L��L�� ���H)�H��H��0����ϳ��H��0���L�� ���I�I�v0I�V8H9�t0H��L��L�� ���H)�H��H��0���蒳��H��0���L�� ���Iϋ�(�����w.���H�ੀA����X�����A�FHA�GA�I�F(H�����	H��L��8�����Dž ����@��H���I�F@H���t+H��I�A�8�r����� ���A�P���H����@�� ���L��H����
I9���	M���VH���ZA�H;�8�����H���#	���	L��H������I��H���TC�*L��������L�����L�����H��0���������fDH��0���L��A����DžD�������L)����(���H�����LF��������H�5�4Hc�H�>��f�H��H��H��H%�H)�H���H��H9���H��H��$���H����1���L��H��I���~I9�sKM���`H���r	A�H;�8�����H��������L��H���ڱ��H���H��B�+%M�FI��XI�H�����L9����M���n���DI����&I��L��(���臯��L��(���H��0���M��fDL;�8���t	M����H�����H��tH���*���H������H��H���H�� H9�t����H���H��X���H��H9�t��H��0���E1��H�}�dH3<%(L����H�e�[A\A]A^A_]�D�������ȱ��H�=33H�@Hc�H�>��D諮��H��0����U����E1����M�I9����H�������H;�8���I����H������fDL��L�� �����(���H��0������H��0�����(���H��I��L�� ����{M�������H��L��H��L��(���H��0����n���H��0���L��(���H������A�lI��A�lI����I��L��8���謭��L��8���H��0���M��L���p����-���I�FPK�<*H��H�X���L�H�� ���L�������+���
H�������L�����L���1�H��������L����^_��D������8Hc�L9�sL�B�<)����9�}��D����BL9��>H������Q�B1�L���M����K�$H����H9�HC�I9����M�L9���@L;�8�����M�������}L��L��L�����k���L����H���KI�����I�FPH��H�X���D�H�� ���K�<*L�����������rH�������L�����H�����L��1���ë��Z��D���YL����������H��������������H��0���M�׋��uA�FH�T���<c�E�L;�8���t
M��tL���f���H�����H��tH���R���H������H��H���H�� H9�t�6���H���H��X���H��H9�t����H��0���E1ɉ�'���f�I�FPK�<*L����H��H�X����h�� ����������{H��L������<$����I�FPK�<*L����H��H�X����@�� �����������L�����L������L��H�������B���L�����D���fDI�FPH��H�X���D�H�
����I�FPH��H�X���D�H����I�FPH��H�X���D�H�����I�FPH��H�X���D�H����x>M�I9������H����2���I�����L�(M�����D�
f.�I��L��(���I��莩��H��0�������f����dHDž���H�D$H���H������=���@D�(M���|���DfD�(M���k���@D�(M���\���DI����V���fDM������L��L����衪��L����H��H��t�M��������L��L��H���C���I�����H���t�I������DH�������AQ��L���PD��H����L��1�L�����H������A���H�� L�����?���������AQD��H����<���@H�������AQ�f.������AQ��fD�G�W����I���H����Dž ����g����L�爕0���蒩����0���H��I���/���M������������L��H��H���0���I������I�����I��M����������DI������M���"��L�爕0���������0���H��H�������M���6���.H��L��H��蠨��H���J����L������H������H��H���H�� H9�t�Ħ��H���H��X���H��H9�t訦���æ��E1�����DM�������M�I9������H�����I�����f�A�LI����H���������L���H�����D��H����L��L�����H���|$P1�����H��0L��������H�������H���<$�u���f.���L��������PD��H���L������L��H������蜥��AXL����AY���@H��������@�����H��0���Lc�M�L������L;�8���t
M��tL���R���H�����H��tH���>���H������H��H���H�� H9�t�"���H���H��X���H��H9�t����H��0���E1��K�����H)�H�L����f�H���*���I��L��H����I9�s[M���IH���QA�L;�8���A��M����E����L��L��L��0���蛦��L��0���H������I��C�)L;�8���t%I9�v L��H��L��8����c���L��8���H��LE�H�����H��tL��8�������L��8���H������H��H���H�� H9�tL��8�����L��8���H���H��X���H��H9�tL��8����ɣ��L��8���H����L�(���L��L��0����t���L��0���H��H����M��t?E��t:L��L��H������I���	������M�I9������H������I�����I������I�������I��M������������I����������fD��H�>H�Ft]1�L��'L�(L�
�'�8���Ic�L�>�����/��A�Ӄ�L_�I�H�PH��H�� H9w�1��f����/wqA�Ӄ�L_�A��P��D���/wyA�Ӄ�L_�A�f�P�@���/wIA�Ӄ�L_�A��P�DL�_I�SH�W�v����L�_I�SH�W�f.�L�_I�SH�W�f�L�_I�SH�W�f��W�����A�Ӄ�L_�W�A�@����DH�WH��H���L�ZL�_�*�x��f����/��A�Ӄ�L_�I�H��ID�H�P����fD���/w9A�Ӄ�L_�I�H��ID�H�P���f.�������f.�L�_I�SH�W��f�L�_I�SH�W�;����L�_I�SH�W�n������AWH�F I��A�AVA�I�����AUI��ATUSH��XH�FH�D$(H�BH�H�D$H�H�BH�NH�D$L�6H�D$H�D$ �f�H�o<%t9H�����u�K��I�FH�<�H�D$I�@H�D$I�@1�H��X[]A\A]A^A_�K��M��I�FL�$�I�<$A�D$I�D$I�D$ M�T$(I�D$0I�D$8M�T$@M�T$P�_�C�<	w3���-t;��+tF�� tQ��#t\��0tg��IujA�L$@@�H��H�M��'u�A�L$��A�L$���A�L$���A�L$��A�L$��A�L$ 렀�*tp�C�<	����.�1���=fD��L����lt"��jt�ڃ�߀�Zt��t��f.����]H����hu��������	���H�t$�I�l$I�L$ H��HE�H�D$�E�PЀ�	�2I�\$(H�����M�uI9��,I�EH9�w'fDH�PH��I�UA�I�EM�uH9�v�H��I��������H��H����.������}*I�l$0�zH�t$�H�MI�L$8H��HC�H�D$�E�PЀ�	��I�\$@H�����M�uI9��JI�UH9�w)�H�BH��I�EA�I�UM�uH9�v�H��H��L������H����K���f.����{����Sۀ�S��H�
�"��Hc�H�>��1Ƀ�����
I����gM�|$PM�uM9���I�EL9�w)�H�PH��I�UA�I�EM�uL9�v�I��K�>����w�A�\$HI�l$I�L�pM�0M9�v	I�H�Q���M����H��袋.��K�H9���K��M�`L�D$8I�4CL�L$0H��L9d$(��L��茞��L�L$0L�D$8I�����H��H���VM�`M�0L9d$(��I�HI������H��fDH����JЀ�	v�M�׀�$�k���1��
@��	�JH����������L�փ�0Hc�H9�wH�4�H�H��1��]H�@��H��H���s�H��t�@��	���L��H���0Hc����E��0<	�r@H�����0<	v�H��H)�H��H�t$I�L$8�H9�HC�H�D$�,���M�H�CI9�LF�H��������I9��kL��L�D$HH��L9t$L�L$@L�\$8H�L$0�/L���,���I�UH�L$0I�����H��I��L�\$8L�L$@L�D$H�I�EH9T$�M�u�F���H�t$ H�FI�t$(H����	H�\$ H�D$ ����H���j���L�L$0L�D$8H��H���K��H��L��L�D$8I�FL�L$0H������L�D$8L�L$0I�����H��M�0�
����	��������������������������Ƀ�������1Ƀ����������c�����������1ɨ��������
���y�����q�������c������V�������Ƀ����C�����s�4���H��H���2�~�@��	v�@��$�����1��	��	�WH����������0L��H�H9�wH��H�H��1�H�@��H���H�֍X�H��t���	w^��0L��H��H��ӹ��������������������������������1ɨ�����r����M�uL9t$tL��L�D$萘��L�D$I�xH9|$(t�{���薘���������(���9�������@M�I�GM9�LF�H��������I9��hL��L�D$HH��L9t$L�L$@L�\$8�L$0��L���*����L$0L�\$8I�����H��I��L�L$@L�D$H��H�D$I;E�M�u���H�t$ H�FI�t$PH�������L�|$ H�D$ �w���I�l$�E��0<	w5H���H���AH�Q��0<	v�H�t$H��H��H)�H��H9�HC�H�D$I�l$ �]������������H��H������H�������L$0L�\$8H��L�L$@L�D$HtdI�UL��H��L�D$HL�L$@I��H��L�\$8�L$0葘��L�D$H�L$0I�����L�L$@L�\$8���I��L9t$tL��L�D$軖��L�D$I�xH9|$(t視������H��X�����[]A\A]A^A_�M�H�CI9�LF�H��������I9�w�L��L�D$HH��L9t$L�L$@L�\$8H�L$0��L���\���I�uH�L$0I�����H��I��L�\$8L�L$@L�D$H�?���I�UH9t$��M�u�,������L����H�����H��譗��H�L$0L�\$8H��H��L�L$@L�D$H����I�EH��L��H��L�D$HH��L�L$@I��L�\$8H�L$0�0���I�EL�D$HI�����L�L$@L�\$8H�L$0���M�uL9t$��������H�t$ H�FI�t$@H��������H�\$ H�D$ �S���H��H���2�~�@��	v�@��$�'���1��	��	��H����������0L��H�H9�wH��H�H��1�H�@��H���H�֍X�H��t���	������0L��H��H���I��I��I��������H�i�Y��H���_���H�L$0L�\$8H��L�L$@L�D$H�����I�UH�t$I��H��L��L�D$HL�L$@L�\$8H�L$0���I�UL�D$HI�����L�L$@L�\$8H�L$0� ���H�͸���H�Z�H����_���I�\$@H�O����M�u�!���H�Z�H����:���I�\$(H�O�@���L��L�t$���I����L��L�t$���f���AWI��AVI��AUA��ATL�%d8 UH�-d8 SL)�H���'���H��t1��L��L��D��A��H��H9�u�H��[]A\A]A^A_�ff.����f.����H�8 1�鞕����H��H���!===-nt-ot-ef-eq-ne-lt-le-gt-geinvalid integer %smissing argument after %s-nt does not accept -l-ef does not accept -l-ot does not accept -l%s: unknown binary operator!%s: unary operator expected(%s expected%s expected, found %s-a-o%s: binary operator expectedtesttest and/or [test invocationMulti-call invocationsha224sumsha2 utilitiessha256sumsha384sumsha512sum
%s online help: <%s>
GNU coreutilsen_/usr/share/localeextra argument %s؞������������������8����������������������������������������x���0�������������`���������������������������x���8���К��������`���0��������Try '%s --help' for more information.
Usage: test EXPRESSION
  or:  test
  or:  [ EXPRESSION ]
  or:  [ ]
  or:  [ OPTION
Exit with the status determined by EXPRESSION.

      --help     display this help and exit
      --version  output version information and exit

An omitted EXPRESSION defaults to false.  Otherwise,
EXPRESSION is true or false and sets exit status.  It is one of:

  ( EXPRESSION )               EXPRESSION is true
  ! EXPRESSION                 EXPRESSION is false
  EXPRESSION1 -a EXPRESSION2   both EXPRESSION1 and EXPRESSION2 are true
  EXPRESSION1 -o EXPRESSION2   either EXPRESSION1 or EXPRESSION2 is true

  -n STRING            the length of STRING is nonzero
  STRING               equivalent to -n STRING
  -z STRING            the length of STRING is zero
  STRING1 = STRING2    the strings are equal
  STRING1 != STRING2   the strings are not equal

  INTEGER1 -eq INTEGER2   INTEGER1 is equal to INTEGER2
  INTEGER1 -ge INTEGER2   INTEGER1 is greater than or equal to INTEGER2
  INTEGER1 -gt INTEGER2   INTEGER1 is greater than INTEGER2
  INTEGER1 -le INTEGER2   INTEGER1 is less than or equal to INTEGER2
  INTEGER1 -lt INTEGER2   INTEGER1 is less than INTEGER2
  INTEGER1 -ne INTEGER2   INTEGER1 is not equal to INTEGER2

  FILE1 -ef FILE2   FILE1 and FILE2 have the same device and inode numbers
  FILE1 -nt FILE2   FILE1 is newer (modification date) than FILE2
  FILE1 -ot FILE2   FILE1 is older than FILE2

  -b FILE     FILE exists and is block special
  -c FILE     FILE exists and is character special
  -d FILE     FILE exists and is a directory
  -e FILE     FILE exists
  -f FILE     FILE exists and is a regular file
  -g FILE     FILE exists and is set-group-ID
  -G FILE     FILE exists and is owned by the effective group ID
  -h FILE     FILE exists and is a symbolic link (same as -L)
  -k FILE     FILE exists and has its sticky bit set
  -L FILE     FILE exists and is a symbolic link (same as -h)
  -O FILE     FILE exists and is owned by the effective user ID
  -p FILE     FILE exists and is a named pipe
  -r FILE     FILE exists and read permission is granted
  -s FILE     FILE exists and has a size greater than zero
  -S FILE     FILE exists and is a socket
  -t FD       file descriptor FD is opened on a terminal
  -u FILE     FILE exists and its set-user-ID bit is set
  -w FILE     FILE exists and write permission is granted
  -x FILE     FILE exists and execute (or search) permission is granted

Except for -h and -L, all FILE-related tests dereference symbolic links.
Beware that parentheses need to be escaped (e.g., by backslashes) for shells.
INTEGER may also be -l STRING, which evaluates to the length of STRING.

NOTE: Binary -a and -o are inherently ambiguous.  Use 'test EXPR1 && test
EXPR2' or 'test EXPR1 || test EXPR2' instead.

NOTE: [ honors the --help and --version options, but test does not.
test treats each of those as it treats any other nonempty STRING.

NOTE: your shell may have its own version of %s, which usually supersedes
the version described here.  Please refer to your shell's documentation
for details about the options it supports.
https://www.gnu.org/software/coreutils/Report %s translation bugs to <https://translationproject.org/team/>
Full documentation at: <%s%s>
or available locally via: info '(coreutils) %s%s'
write error%s: %sA NULL argv[0] was passed through an exec system call.
/.libs/lt-’��"'�e‘`literalshellshell-alwaysshell-escapeshell-escape-alwayscc-maybeclocale���������������H���_�������������������$���Ѫ��Ѫ��Ѫ��Ѫ��Ѫ��Ѫ�����������ԩ�������������Ѫ��Ѫ��Ѫ��Ѫ��Ѫ��Ѫ��Ѫ��Ѫ��Ѫ��Ѫ��Ѫ��Ѫ��Ѫ��Ѫ��Ѫ��Ѫ��Ѫ��Ѫ��/���������%������������y������������������������������������������������������������������������I���Ѫ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������9������9���%�����ը��ը��ը��ը��ը��ը��ة��ȩ������������������X���ը��ը��ը��ը��ը��ը��ը��ը��ը��ը��ը��ը��ը��ը��ը��ը��ը��ը������p���p�������p���+���p���}���p���p���p���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���p���p���p���p���M���ը��+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���p������+���p���+���p���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���+���=���p���=����������Ԧ��Ԧ��Ԧ��Ԧ��Ԧ��Ԧ����������ܥ�������������Ԧ��Ԧ��Ԧ��Ԧ��Ԧ��Ԧ��Ԧ��Ԧ��Ԧ��Ԧ��Ԧ��Ԧ��Ԧ��Ԧ��Ԧ��Ԧ��Ԧ��Ԧ���������������ܨ�����|������������ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��������������L���Ԧ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ���������ܨ�����ܨ�����ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��ܨ��<������<����	unable to display error messagememory exhaustedCPOSIXASCII�~�����������x��������P��P��P��P�������������P��P��P��`��P��@��������(NULL)��������������������������������`�����������������������������������(NULL)���,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,���,���,�������,�,�,�,�,�,�,�,�,�,�,�T�,�,�,�,��,�,�,�,�,�,�,�,���,������������,���,�,�,�,������,�,���,��,�,��;�^Tv��,ty��T�|����|��l�|���|��8
�|��h
�|��h�|��,�|����}���~��l��������������ā���������$$����T��������D���T���LĔ���ԙ������$����T���lě�������������D���$����P����dı��x����$����d������	Գ��t	���	�����	�����	�����	Ĵ���	��
����L
���|
$����
D����
���
����
���$�����|���������������Ը�����������0$���D����\T����t���������ļ���Լ��
���,
D���@
Խ��X
4���p
T����
�����
ľ���
���
$���t���X$���t�����D��������,T��L����4�������t��D���\���D�T�$zRx�xz��/D$4 s�� FJw�?:*3$"\v�� t{��dA�
H�\|���AAG���|���A��
J��}��<O���}��'b(�}���A�A�G�o
AAF8,����pB�D�A �A(�G��
(A ABBF zRx������(�w�������'������x�a�\�0�0���?Dz
Bj
FR
FD
LD
LH<���B�B�B �B(�A0�A8�DP_
8A0A(B BBBI\T���iB�B�A �A(�D0r
(A ABBF�
(A ABBJD
(C ABBE ����F�A�C �D�(��v���E�D�F �
AAAГ��̓��,,ȓ���E�A�D @
AAA\X���Pt�����E��
A<�0����A�D�F T
AAGv
AAHrAAt����B�B�E �B(�D0�D8�J���J�J�B�Z�d
8A0A(B BBBF�
�P�D�D�[�$zRx��������,u��h�����B�E�E �B(�A0�D8�D`�hbpIxB�S`@hTpCxB�X`L
8D0A(B BBBF zRx�`������(vt��(,���:F�A�A �nABX,���l8����D���9�p����|���1lP�����xF�L�E �E(�A0�A8�GPUXW`FhApU8A0A(B BBBhԩ���F�L�E �B(�D0�A8�GphxQ�C�B�Zp_xF�C�G�Up[8A0A(B BBB|X���(�T����L�H�A �zAB�Ȫ���Ԫ���Ъ���̪��ت���HP�
AzRx�PSr��T0����HP
AL(r������������0������F�L�D �D`q
 AABA�����������0����F�A�A �D`�
 AABAzRx�`���$-q��8�`����F�E�D �C(�Dpq
(A ABBA�Ĭ��������̬���ج��	Ԭ��$	��8	ܬ��L	ج��iLd	0����F�E�H �G(�D0�s
(A BBBH[
(A BBBE�	�����	����E�S
A�	����(c�	ȯ��	 
�>E�`
KH
A4
��(cH
�����\L`
t���XSx
����E�V�
����2Ka
A$�
��-E�G�G WAA�
��E�L�
�>EARH���LB�B�B �B(�A0�A8�D`
8A0A(B BBBD`����H z
F<|�����F�E�D �A(�G@I
(A ABBJ$������E�L I
AA,�`���eF�A�D �t
ABF����`Hu
C_4��<Ha
GK4T����F�A�A �}
ABH`
ABM�X���HE�]
NS,�����_k�D�D �hAB,������E�C
D��K��D�
F$zRx�������,nl��
L
(��dd
0��>
F�O�O �E(�A0�A8�D��
8A0A(B BBBA�	
8F0A(B BBBAD�
��eF�E�E �E(�H0�H8�G@n8A0A(B BBB0��,(���p�� 1�9�?�L�Y�m�o�R���w�h
���� �� ���o0�P
�� ���@	���o���o0���o�o����o� ������ 0@P`p�������� 0@P`p�������� 0@P`p���p� �� GA$3a1h�GA$3p1067���GA*GA$annobin gcc 8.5.0 20210514GA$running gcc 8.5.0 20210514GA*GA!
GA*FORTIFYGA+GLIBCXX_ASSERTIONSGA*cf_protectionGA+omit_frame_pointerGA+stack_clashGA!stack_realignGA$plugin name: gcc-annobin��uGA*GA*GOW*�GA$3a1��GA$3p10677��GA*GA$annobin gcc 8.5.0 20210514GA$running gcc 8.5.0 20210514GA*GA!
GA*FORTIFYGA+GLIBCXX_ASSERTIONSGA*cf_protectionGA+omit_frame_pointerGA+stack_clashGA!stack_realignGA$plugin name: gcc-annobin7�GA*GA*GOW*�GA$plugin name: annobin���GA*GA*GOW*GA$plugin name: annobin����GA*GA*GOW*GA+GLIBCXX_ASSERTIONS��]
GA*FORTIFY7��GA+GLIBCXX_ASSERTIONS
GA*FORTIFY��]test-8.30-15.el8.x86_64.debug��N�7zXZ�ִF!t/���
]?�E�h=��ڊ�2N�`�:. ��ۺP��jgW�Ϟ�@��ĭj�*
>��B��.�Ps�_��W���0o�s*i3�t�\D}� ��:�m8�VN�(��\���5�/8�����-�?{k!p�c��/��]�����+
�ە�7a^���1�͎ܱ�"P���0E���\�z�HU�����T�4V���utA�&ZK8�7�e1�d_�Ɋ����ެ
�F���gV���X5vD�H`�xE��UZ�:�:�`��s��1�ݍ�ש�0����?^_�S,�J����s�&�ӎ�>r���ApϼK�1�26iQ�\��	v���GX}�<����C϶�#�4ƜϷ�L�B�1�d�JR|��Ug���!�Vo�jR�
r���U+(eJ���b���\��0|�0����@�9Q�&)���ĺv��,XUyr4�O�;7m��D�
�����k��
��3*��RYŒ����8(��p�+�q���`���%
�(��}rD8W�
7��(��S���2z�T�F�M�ߑ��q�6����ao���!�$��! b-�H���3l�׳�0�'�"E@�]q�Ol
#��9�d�a�6��h@Ւ�U���'���C���g�JΫL��;:g"ObܮQ��*����e�7>0Z}u��t���y����eTuN_{N��)����`�^k���_k�=��cN�����$��L�	����ę
�,�f_�*j��t^��}��^����8�q��\�8A@0��G�a/��p�k_��޲���'4���h�J��yuL-��繼���cҭg^*��m�%M<���N��ZsU�{M�g>?��{�vS~���)-4��&C���Jaةo�1��w�L����v}&�Ħ1-�95Ty.E�#�_�i#�7M�/�•��jT�]?��#�|H�.Ȗ�K;�?z$�ow���̍�7����xV�yz�"Ol&)��E��#�'Eأ�~��gxCv6��*&���f�|���P�4������yM�����y�67�ÊO1�:�@��[ZVT�����6Wz�-,ÿ'�E1w�T`�`KZ�*"Ls�����j��������s�ek?��>_0*;����Uc`XM�ӕ�8{�H�$Z��DϨC
���G�
0.���0ٳ�k��"ʙ���
�8�	"f���>���O���1,��:�?q�w��}��+��4���x�s����0��E�	�Ggp"���6��>/�lU� x��IL?�B�?N���t�v�>s�
`g��9m�u���k���,�@����V�*�[>V>�؛#�1�-n�A#82���|0�(�N�W5�j 8:v�B�Ğl/��ʋ��ڷPy���ɭ��/+֍��(�T�}h��莭1.*�<���@��+^�a���j�%YQ�i�����)Wvm�ց8�Ii̒����y'��jR��~�a4�'��>g s��{��xi�7�l�y�k�������/��֔����	EP��y�rvř����u��t!���‘-1)a��5�6l�6�����Xc@����c>���(��T�N��%�=������"�ڦ�L�&��|���<��B�K.4}E�y����p�V5��^L+V[
�;�ؼ(�O�u����2�ˬ�Al�0���m��"��N3;+��n��ٶ��,A��Q?Z�懊s��@�cXB��~c��$�R��˽c���ʑ�9 ������#�:W�Bl\��Y�m�yȓ.2����9"���g�YZ.shstrtab.interp.note.gnu.property.note.ABI-tag.note.gnu.build-id.gnu.hash.dynsym.dynstr.gnu.version.gnu.version_r.rela.dyn.rela.plt.init.plt.sec.text.fini.rodata.eh_frame_hdr.eh_frame.init_array.fini_array.data.rel.ro.dynamic.got.data.bss.gnu.build.attributes.gnu_debuglink.gnu_debugdata���� &�� 4$G���o00QPP�Y���a���o��xn���o00`}��@�B����hh��� �������i�����
�����| �<�<���8�8�@��� ����� ����� ��x �� ���� ���� �� �� ��x 
��`��� �$/,�P|�>qtestroot/plugins.qmltypes000064400000001403150351131160012063 0ustar00import QtQuick.tooling 1.2

// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.

Module {
    dependencies: ["QtQuick 2.0"]
    Component {
        file: "private/quicktest_p.h"
        name: "QTestRootObject"
        prototype: "QObject"
        exports: ["Qt.test.qtestroot/QTestRootObject 1.0"]
        isCreatable: false
        isSingleton: true
        exportMetaObjectRevisions: [0]
        Property { name: "windowShown"; type: "bool"; isReadonly: true }
        Property { name: "hasTestCase"; type: "bool" }
        Property { name: "defined"; type: "QObject"; isReadonly: true; isPointer: true }
        Method { name: "quit" }
    }
}
qtestroot/qmldir000064400000000063150351131170010017 0ustar00module Qt.test.qtestroot
typeinfo plugins.qmltypes
widget_tests.pyo000064400000063575150351526560010032 0ustar00�
zfc@sVddlZddlZddlZddlmZddlmZmZm	Z	m
Z
mZmZddl
ZeZZe
�dddfkr�eZneo�ee�Zd�ZeZe
�d dddfkr�eZne�Zd	efd
��YZdefd��YZd
efd��YZdefd��YZd�Zd�ZdS(i����N(tScale(tAbstractTkTestttcl_versiontrequires_tcltget_tk_patchleveltpixels_convt
tcl_obj_eqiiicCstt|��S(N(tinttround(tx((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt	int_roundsitAbstractWidgetTestcBs�eZee�ZdZeZe	d��Z
d�Zdej
d�Zeedd�Zded�Zd�Zd�Zd�Zd�Zdd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Z RS(cCsEy|jSWn3tk
r@t|jjdd��|_|jSXdS(Nttktscaling(t_scalingtAttributeErrortfloattroottcall(tself((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyR
"s

cCsU|jr#|jr#tdkr#|St|t�rKdjt|j|��St|�S(Niit (ii(	t
_stringifytwantobjectsRt
isinstancettupletjointmapt_strtstr(Rtvalue((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyR*s
cCs*|||�rdS|j|||�dS(N(tassertEqual(Rtactualtexpectedtmsgteq((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytassertEqual21scCs|||<|tkr|}n|r4||�}n|jsG|jrwt|t�rhtj|�}qwt|�}n|dkr�t	}n|j
|||d|�|j
|j|�|d|�t|t�s|j
|�}|jt|�d�|j
|d|d|�ndS(NR"ii(t	_sentinelRRRRttkintert_joinRtNoneRR#tcgetRt	configureRtlen(RtwidgettnameRR tconvR"tt((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt
checkParam6s"
		c	Cs||}|dk	r(|j|�}n|jtj��}|||<WdQX|dk	ru|jt|j�|�n|r�|j|||�n
|||<|jtj��}|ji||6�WdQX|dk	r�|jt|j�|�n|r|j|||�n
|||<dS(N(	R'tformattassertRaisesR%tTclErrorRRt	exceptionR)(RR+R,Rterrmsgt	keep_origtorigtcm((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckInvalidParamLs"

cOs+x$|D]}|j||||�qWdS(N(R/(RR+R,tvaluestkwargsR((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckParamsbs
cOse|j||||�|j||ddd�|j||ddd�|j||ddd�dS(NtR4sexpected integer but got ""t10psexpected integer but got "10p"g������	@sexpected integer but got "3.2"(R;R8(RR+R,R9R:((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckIntegerParamfscOs�d|kr|jd�}nt}x*|D]"}|j|||d||�q+W|j||ddd�|j||ddd�dS(NR-R<R4s)expected floating-point number but got ""tspams-expected floating-point number but got "spam"(tpopRR/R8(RR+R,R9R:R-R((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckFloatParamos
 cCs�x6tddddfD]}|j|||dd�qWx6tdddd	fD]}|j|||dd�qOW|j||d
dd�|j||d
dd�dS(NitfalsetnotoffR ittruetyestonR<R4s!expected boolean value but got ""R?s%expected boolean value but got "spam"(tFalseR/tTrueR8(RR+R,R((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckBooleanParam{scKsN|j||ddddddddd	d
|�|j||ddd
�dS(Ns#ff0000s#00ff00s#0000ffs#123456tredtgreentbluetwhitetblacktgreyR?R4sunknown color name "spam"(R;R8(RR+R,tallow_emptyR:((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckColorParam�scKs^|j||dddd|�tdkrA|j||d�n|j||dd	d
�dS(NtarrowtwatchtcrossR<iitnoneR?R4sbad cursor spec "spam"(ii(R;RR/R8(RR+R,R:((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckCursorParam�s
cCs;d�}|||<|j||�|j||d�dS(NcWsdS(N((targs((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcommand�sR<(t
assertTrueR;(RR+R,RY((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckCommandParam�s	
cOs�d|kr|jd�}nd}|j||||�|dkr�d|dj|d �t|�dkrtdnd|df}|j||ddd|�d	|}n|j||d
d|�dS(NR4s %s "{}": must be %s%s or %ss, i����it,R<t	ambiguoustbadR?(R@R'R;RR*R8(RR+R,R9R:R4terrmsg2((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckEnumParam�s
c

Os!d|kr|jd�}nd}|dkr<|j}nd|krZ|jd�}nt}x||D]t}t}|}	t|t�r�|	r�|	tk	r�t|�|j}t	}	q�n|j
|||d|d|	|�qgW|j||dddd|�|j||dddd|�dS(	NR-R5R t6xR4sbad screen distance "6x"R?sbad screen distance "spam"(R@R't_conv_pixelsRIR$RRRR
R
R/R8(
RR+R,R9R:R-R5RR tconv1((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckPixelsParam�s*

c	CsZ|j||dddddd�d}tdkr=d}n|j||d
d|�dS(
NtflattgroovetraisedtridgetsolidtsunkensHbad relief "spam": must be flat, groove, raised, ridge, solid, or sunkeniiR?R4(ii(R;RR'R8(RR+R,R4((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckReliefParam�s	cCs[tjd|jdd�}|j|||dt�|j||ddd�d||<dS(	NtmasterR,timage1R-R?R4simage "spam" doesn't existR<(R%t
PhotoImageRR/RR8(RR+R,timage((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckImageParam�s
cCs|j|||dt�dS(NR-(R/R(RR+R,tvar((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckVariableParam�scCs�|j|�|j|t�t|�dkrF|jd|f�nx5|D]-}t|t�sM|jd|f�PqMqMWdS(NisInvalid bounding box: %r(tassertIsNotNonetassertIsInstanceRR*tfailRR(Rtbboxtitem((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytassertIsBoundingBox�s

cCs|j�}|j�}t|t�sL|jt|�t|j���nx|D]}||qSWtjj	ridd6dd6dd6dd6d	d
6}t
|�}t
|j�}x_t||�D]J}||ko�|||ko�|||ks�d|jj
|fGHq�q�WndS(Ntborderwidthtbdt
backgroundtbgt
foregroundtfgtinvalidcommandtinvcmdtvalidatecommandtvcmds%s.OPTIONS doesn't contain "%s"(tcreatetkeysRRRtsortedR)ttestttest_supporttverbosetsettOPTIONSt	__class__t__name__(RR+R�tktaliasesR ((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt	test_keys�s*%

N(!R�t
__module__tstaticmethodtpixels_roundRbR't_conv_pad_pixelsRHRtpropertyR
Rtobjectt__eq__R#R$R/RIR8R;R>RARJRRRWR[R`RdRkRpRrRxR�(((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyRs0						
					
			
tStandardOptionsTestsc*BseZdbZd*�Zd+�Zd,�Zd-�Zd.�Zd/�Zd0�Z	d1�Z
d2�Zd3�Zd4�Z
d5�Zd6�Zd7�Zd8�Zd9�Zejejd:kd;�d<��Zd=�Zd>�Zd?�Zd@�ZdA�ZdB�ZdC�ZdD�ZdE�Z dF�Z!dG�Z"dH�Z#dI�Z$dJ�Z%dK�Z&dL�Z'dM�Z(dN�Z)dO�Z*dP�Z+dQ�Z,dR�Z-dS�Z.dT�Z/dU�Z0dV�Z1dW�Z2dX�Z3dY�Z4dZ�Z5d[�Z6d\�Z7e8d]d^�d_��Z9e8d]d^�d`��Z:da�Z;RS(ctactivebackgroundtactiveborderwidthtactiveforegroundtanchorR{tbitmapRytcompoundtcursortdisabledforegroundtexportselectiontfontR}thighlightbackgroundthighlightcolorthighlightthicknessRotinsertbackgroundtinsertborderwidtht
insertofftimetinsertontimetinsertwidthtjumptjustifytorienttpadxtpadytrelieftrepeatdelaytrepeatintervaltselectbackgroundtselectborderwidthtselectforegroundtsetgridt	takefocusttextttextvariablettroughcolort	underlinet
wraplengthtxscrollcommandtyscrollcommandcCs |j�}|j|d�dS(NR�(R�RR(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_activebackground
sc	Cs2|j�}|j|ddddddd�dS(NR�ig�������?g333333@ii����R=(R�Rd(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_activeborderwidthscCs |j�}|j|d�dS(NR�(R�RR(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_activeforegroundscCs;|j�}|j|ddddddddd	d
�dS(NR�tntnetetsetstswtwtnwtcenter(R�R`(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_anchorscCsB|j�}|j|d�d|jkr>|j|d�ndS(NR{R|(R�RRR�(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_backgroundscCs�|j�}|j|dd�|j|dd�tjjddd�}|j|dd|�d|jjjd	d
�ko�d|jj�ks�|j	|ddd
d�ndS(NR�t	questheadtgray50s
python.xbmtsubdirt
imghdrdatat@taquaRtwindowingsystemtAppKitR?R4sbitmap "spam" not defined(
R�R/R�R�tfindfileRRRtwinfo_serverR8(RR+tfilename((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_bitmap%sc	Csf|j�}|j|ddddddd�d|jkrb|j|ddddddd�ndS(	NRyig�������?g������@ii����R=Rz(R�RdR�(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_borderwidth2s
c	Cs2|j�}|j|ddddddd�dS(NR�tbottomR�tleftRVtrightttop(R�R`(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt
test_compound9scCs |j�}|j|d�dS(NR�(R�RW(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_cursor>scCs |j�}|j|d�dS(NR�(R�RR(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_disabledforegroundBscCs |j�}|j|d�dS(NR�(R�RJ(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_exportselectionFscCs<|j�}|j|dd�|j|dddd�dS(NR�s3-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*R<R4sfont "" doesn't exist(R�R/R8(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt	test_fontJs
cCsB|j�}|j|d�d|jkr>|j|d�ndS(NR}R~(R�RRR�(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_foregroundQscCs |j�}|j|d�dS(NR�(R�RR(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_highlightbackgroundWscCs |j�}|j|d�dS(NR�(R�RR(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_highlightcolor[scCsQ|j�}|j|dddddd�|j|ddddd	|j�dS(
NR�ig�������?g������@iR=i����R R-(R�RdR/Rb(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_highlightthickness_s
tdarwins"crashes with Cocoa Tk (issue19733)cCs |j�}|j|d�dS(NRo(R�Rp(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt
test_imagefscCs |j�}|j|d�dS(NR�(R�RR(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_insertbackgroundlsc	Cs2|j�}|j|ddddddd�dS(NR�ig�������?g������@ii����R=(R�Rd(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_insertborderwidthpscCs#|j�}|j|dd�dS(NR�id(R�R>(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_insertofftimeuscCs#|j�}|j|dd�dS(NR�id(R�R>(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_insertontimeyscCs,|j�}|j|ddddd�dS(NR�g�������?g������@i����R=(R�Rd(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_insertwidth}scCs |j�}|j|d�dS(NR�(R�RJ(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt	test_jump�scCsH|j�}|j|dddddd�|j|dddd�dS(	NR�R�R�R�R4s6bad justification "{}": must be left, right, or centerR<s:ambiguous justification "": must be left, right, or center(R�R`R8(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_justify�s
cCsC|j�}|jt|d�|j�|j|ddd�dS(NR�t
horizontaltvertical(R�RRtdefault_orientR`(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_orient�sc
Cs8|j�}|j|ddddddd|j�dS(NR�ig������@gffffff@i����t12mR-(R�RdR�(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt	test_padx�sc
Cs8|j�}|j|ddddddd|j�dS(NR�ig������@gffffff@i����R�R-(R�RdR�(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt	test_pady�scCs |j�}|j|d�dS(NR�(R�Rk(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_relief�scCs&|j�}|j|ddd�dS(NR�i���i�(R�R>(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_repeatdelay�scCs&|j�}|j|ddd�dS(NR�i���i�(R�R>(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_repeatinterval�scCs |j�}|j|d�dS(NR�(R�RR(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_selectbackground�scCs,|j�}|j|ddddd�dS(NR�g�������?g������@i����R=(R�Rd(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_selectborderwidth�scCs |j�}|j|d�dS(NR�(R�RR(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_selectforeground�scCs |j�}|j|d�dS(NR�(R�RJ(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_setgrid�scCs)|j�}|j|dddd�dS(Ntstatetactivetdisabledtnormal(R�R`(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt
test_state�scCs)|j�}|j|dddd�dS(NR�t0t1R<(R�R;(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_takefocus�scCs&|j�}|j|ddd�dS(NR�R<s
any string(R�R;(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt	test_text�scCs5|j�}tj|j�}|j|d|�dS(NR�(R�R%t	StringVarRRr(RR+Rq((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_textvariable�scCs |j�}|j|d�dS(NR�(R�RR(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_troughcolor�scCs)|j�}|j|dddd�dS(NR�iii
(R�R>(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_underline�scCs#|j�}|j|dd�dS(NR�id(R�Rd(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_wraplength�scCs |j�}|j|d�dS(NR�(R�R[(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_xscrollcommand�scCs |j�}|j|d�dS(NR�(R�R[(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_yscrollcommand�scCs |j�}|j|d�dS(NRY(R�R[(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_command�scCs |j�}|j|d�dS(Ntindicatoron(R�RJ(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_indicatoron�scCs |j�}|j|d�dS(Nt	offrelief(R�Rk(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_offrelief�scCs |j�}|j|d�dS(Nt
overrelief(R�Rk(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_overrelief�scCs |j�}|j|d�dS(Ntselectcolor(R�RR(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_selectcolor�scCs |j�}|j|d�dS(Ntselectimage(R�Rp(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_selectimage�siicCs |j�}|j|d�dS(Nt
tristateimage(R�Rp(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_tristateimage�scCs#|j�}|j|dd�dS(Nt
tristatevaluet
unknowable(R�R/(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_tristatevalue�scCs5|j�}tj|j�}|j|d|�dS(Ntvariable(R�R%t	DoubleVarRRr(RR+Rq((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt
test_variables(*R�R�R�R�R{R�RyR�R�R�R�R�R}R�R�R�RoR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�(<R�R�tSTANDARD_OPTIONSR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�tunittesttskipIftsystplatformR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�RRRRRR	R
RRR
RRRRRRRRR(((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyR��s�						
																																											tIntegerSizeTestscBseZd�Zd�ZRS(cCs)|j�}|j|dddd�dS(Ntheightidi����i(R�R>(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_height	scCs)|j�}|j|dddd�dS(Ntwidthi�in���i(R�R>(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt
test_width
s(R�R�R'R)(((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyR%s	tPixelSizeTestscBseZd�Zd�ZRS(c	Cs2|j�}|j|ddddddd�dS(NR&idg�����LY@gfffff�Y@i����it3c(R�Rd(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyR'sc	Cs2|j�}|j|ddddddd�dS(NR(i�gfffff6y@g�����Iy@in���it5i(R�Rd(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyR)s(R�R�R'R)(((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyR*s	cs�fd�}|S(Ncs�x��jD]�}d|}t�|�s
xk�D]5}t||�r0t�|t||�j�Pq0q0W|�fd�}||_t�||�q
q
W�S(Nttest_cs1|j�}||td|�jf��dS(NsOption "%s" is not tested in %s(R�tAssertionErrorR�(RtoptionR+(tcls(s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyR�)s(R�thasattrtsetattrtgetattrtim_funcR�(R0R/t
methodnametsource_classR�(tsource_classes(R0s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt	decorators

		((R7R8((R7s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytadd_standard_optionsscCs4tjjr0tj�}dG|jdd�GHndS(Nspatchlevel =tinfot
patchlevel(R�R�R�R%tTclR(ttcl((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytsetUpModule3s(R!R#tTkinterR%tttkRttest_ttk.supportRRRRRRttest.test_supportR�RHtnoconvtnoconv_methRR�R
R�RR�R$RR�R%R*R9R>(((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt<module>s*.
				��

	runtktests.pyo000064400000005453150351526560007542 0ustar00�
zfc@s�dZddlZddlZddlZddlZddlZejjejj	e
��Zd�Zee
dd�Ze
e
dd�Zedkr�ejje��ndS(s�
Use this module to get and run all tk tests.

Tkinter tests should live in a package inside the directory where this file
lives, like test_tkinter.
Extensions also should live in packages following the same rule as above.
i����NcCs.x'tj|�D]}|dkrtSqWtS(Ns__init__.pys__init__.pycs
__init.pyo(s__init__.pys__init__.pycs
__init.pyo(tostlistdirtTruetFalse(tpathtname((s./usr/lib64/python2.7/lib-tk/test/runtktests.pyt
is_packagesc	#s-d�x tj|�D]\}}}x4t|�D]&}|ddkr2|j|�q2q2Wt|�r|r|t|�ttj�jdd�}|r�||kr�qnt�fd�|�}x[|D]P}y$t	j
d|t�� |�VWq�tjj
k
r|r�qq�Xq�WqqWdS(s�This will import and yield modules whose names start with test_
    and are inside packages found in the path starting at basepath.

    If packages is specified it should contain package names that want
    their tests collected.
    s.pyit.t/cs|jd�o|j��S(Nttest_(t
startswithtendswith(tx(tpy_ext(s./usr/lib64/python2.7/lib-tk/test/runtktests.pyt<lambda>+ts.%sN(RtwalktlisttremoveRtlentseptreplacetfiltert	importlibt
import_modulettestttest_supporttResourceDenied(	tbasepathtguitpackagestdirpathtdirnamest	filenamestdirnametpkg_nameR((R
s./usr/lib64/python2.7/lib-tk/test/runtktests.pytget_tests_moduless&)	
ccs�g}|r|jd�n|r2|jd�nxPtd|d|�D]9}x0|D](}xt||d�D]}|VqnWqUWqHWdS(s�Yield all the tests in the modules found by get_tests_modules.

    If nogui is True, only tests that do not require a GUI will be
    returned.ttests_noguit	tests_guiRRN((tappendR$tgetattr(ttextRRtattrstmoduletattrR((s./usr/lib64/python2.7/lib-tk/test/runtktests.pyt	get_tests6s
t__main__(t__doc__RtsystunittestRttest.test_supportRRtabspathR"t__file__t
this_dir_pathRRtNoneR$R-t__name__Rtrun_unittest(((s./usr/lib64/python2.7/lib-tk/test/runtktests.pyt<module>s	widget_tests.py000064400000050155150351526560007641 0ustar00# Common tests for test_tkinter/test_widgets.py and test_ttk/test_widgets.py

import unittest
import sys
import Tkinter as tkinter
from ttk import Scale
from test_ttk.support import (AbstractTkTest, tcl_version, requires_tcl,
                              get_tk_patchlevel, pixels_conv, tcl_obj_eq)
import test.test_support


noconv = noconv_meth = False
if get_tk_patchlevel() < (8, 5, 11):
    noconv = str
noconv_meth = noconv and staticmethod(noconv)

def int_round(x):
    return int(round(x))

pixels_round = int_round
if get_tk_patchlevel()[:3] == (8, 5, 11):
    # Issue #19085: Workaround a bug in Tk
    # http://core.tcl.tk/tk/info/3497848
    pixels_round = int


_sentinel = object()

class AbstractWidgetTest(AbstractTkTest):
    _conv_pixels = staticmethod(pixels_round)
    _conv_pad_pixels = None
    _stringify = False

    @property
    def scaling(self):
        try:
            return self._scaling
        except AttributeError:
            self._scaling = float(self.root.call('tk', 'scaling'))
            return self._scaling

    def _str(self, value):
        if not self._stringify and self.wantobjects and tcl_version >= (8, 6):
            return value
        if isinstance(value, tuple):
            return ' '.join(map(self._str, value))
        return str(value)

    def assertEqual2(self, actual, expected, msg=None, eq=object.__eq__):
        if eq(actual, expected):
            return
        self.assertEqual(actual, expected, msg)

    def checkParam(self, widget, name, value, expected=_sentinel,
                   conv=False, eq=None):
        widget[name] = value
        if expected is _sentinel:
            expected = value
        if conv:
            expected = conv(expected)
        if self._stringify or not self.wantobjects:
            if isinstance(expected, tuple):
                expected = tkinter._join(expected)
            else:
                expected = str(expected)
        if eq is None:
            eq = tcl_obj_eq
        self.assertEqual2(widget[name], expected, eq=eq)
        self.assertEqual2(widget.cget(name), expected, eq=eq)
        # XXX
        if not isinstance(widget, Scale):
            t = widget.configure(name)
            self.assertEqual(len(t), 5)
            self.assertEqual2(t[4], expected, eq=eq)

    def checkInvalidParam(self, widget, name, value, errmsg=None,
                          keep_orig=True):
        orig = widget[name]
        if errmsg is not None:
            errmsg = errmsg.format(value)
        with self.assertRaises(tkinter.TclError) as cm:
            widget[name] = value
        if errmsg is not None:
            self.assertEqual(str(cm.exception), errmsg)
        if keep_orig:
            self.assertEqual(widget[name], orig)
        else:
            widget[name] = orig
        with self.assertRaises(tkinter.TclError) as cm:
            widget.configure({name: value})
        if errmsg is not None:
            self.assertEqual(str(cm.exception), errmsg)
        if keep_orig:
            self.assertEqual(widget[name], orig)
        else:
            widget[name] = orig

    def checkParams(self, widget, name, *values, **kwargs):
        for value in values:
            self.checkParam(widget, name, value, **kwargs)

    def checkIntegerParam(self, widget, name, *values, **kwargs):
        self.checkParams(widget, name, *values, **kwargs)
        self.checkInvalidParam(widget, name, '',
                errmsg='expected integer but got ""')
        self.checkInvalidParam(widget, name, '10p',
                errmsg='expected integer but got "10p"')
        self.checkInvalidParam(widget, name, 3.2,
                errmsg='expected integer but got "3.2"')

    def checkFloatParam(self, widget, name, *values, **kwargs):
        if 'conv' in kwargs:
            conv = kwargs.pop('conv')
        else:
            conv = float
        for value in values:
            self.checkParam(widget, name, value, conv=conv, **kwargs)
        self.checkInvalidParam(widget, name, '',
                errmsg='expected floating-point number but got ""')
        self.checkInvalidParam(widget, name, 'spam',
                errmsg='expected floating-point number but got "spam"')

    def checkBooleanParam(self, widget, name):
        for value in (False, 0, 'false', 'no', 'off'):
            self.checkParam(widget, name, value, expected=0)
        for value in (True, 1, 'true', 'yes', 'on'):
            self.checkParam(widget, name, value, expected=1)
        self.checkInvalidParam(widget, name, '',
                errmsg='expected boolean value but got ""')
        self.checkInvalidParam(widget, name, 'spam',
                errmsg='expected boolean value but got "spam"')

    def checkColorParam(self, widget, name, allow_empty=None, **kwargs):
        self.checkParams(widget, name,
                         '#ff0000', '#00ff00', '#0000ff', '#123456',
                         'red', 'green', 'blue', 'white', 'black', 'grey',
                         **kwargs)
        self.checkInvalidParam(widget, name, 'spam',
                errmsg='unknown color name "spam"')

    def checkCursorParam(self, widget, name, **kwargs):
        self.checkParams(widget, name, 'arrow', 'watch', 'cross', '',**kwargs)
        if tcl_version >= (8, 5):
            self.checkParam(widget, name, 'none')
        self.checkInvalidParam(widget, name, 'spam',
                errmsg='bad cursor spec "spam"')

    def checkCommandParam(self, widget, name):
        def command(*args):
            pass
        widget[name] = command
        self.assertTrue(widget[name])
        self.checkParams(widget, name, '')

    def checkEnumParam(self, widget, name, *values, **kwargs):
        if 'errmsg' in kwargs:
            errmsg = kwargs.pop('errmsg')
        else:
            errmsg = None
        self.checkParams(widget, name, *values, **kwargs)
        if errmsg is None:
            errmsg2 = ' %s "{}": must be %s%s or %s' % (
                    name,
                    ', '.join(values[:-1]),
                    ',' if len(values) > 2 else '',
                    values[-1])
            self.checkInvalidParam(widget, name, '',
                                   errmsg='ambiguous' + errmsg2)
            errmsg = 'bad' + errmsg2
        self.checkInvalidParam(widget, name, 'spam', errmsg=errmsg)

    def checkPixelsParam(self, widget, name, *values, **kwargs):
        if 'conv' in kwargs:
            conv = kwargs.pop('conv')
        else:
            conv = None
        if conv is None:
            conv = self._conv_pixels
        if 'keep_orig' in kwargs:
            keep_orig = kwargs.pop('keep_orig')
        else:
            keep_orig = True
        for value in values:
            expected = _sentinel
            conv1 = conv
            if isinstance(value, str):
                if conv1 and conv1 is not str:
                    expected = pixels_conv(value) * self.scaling
                    conv1 = int_round
            self.checkParam(widget, name, value, expected=expected,
                            conv=conv1, **kwargs)
        self.checkInvalidParam(widget, name, '6x',
                errmsg='bad screen distance "6x"', keep_orig=keep_orig)
        self.checkInvalidParam(widget, name, 'spam',
                errmsg='bad screen distance "spam"', keep_orig=keep_orig)

    def checkReliefParam(self, widget, name):
        self.checkParams(widget, name,
                         'flat', 'groove', 'raised', 'ridge', 'solid', 'sunken')
        errmsg='bad relief "spam": must be '\
               'flat, groove, raised, ridge, solid, or sunken'
        if tcl_version < (8, 6):
            errmsg = None
        self.checkInvalidParam(widget, name, 'spam',
                errmsg=errmsg)

    def checkImageParam(self, widget, name):
        image = tkinter.PhotoImage(master=self.root, name='image1')
        self.checkParam(widget, name, image, conv=str)
        self.checkInvalidParam(widget, name, 'spam',
                errmsg='image "spam" doesn\'t exist')
        widget[name] = ''

    def checkVariableParam(self, widget, name, var):
        self.checkParam(widget, name, var, conv=str)

    def assertIsBoundingBox(self, bbox):
        self.assertIsNotNone(bbox)
        self.assertIsInstance(bbox, tuple)
        if len(bbox) != 4:
            self.fail('Invalid bounding box: %r' % (bbox,))
        for item in bbox:
            if not isinstance(item, int):
                self.fail('Invalid bounding box: %r' % (bbox,))
                break

    def test_keys(self):
        widget = self.create()
        keys = widget.keys()
        # XXX
        if not isinstance(widget, Scale):
            self.assertEqual(sorted(keys), sorted(widget.configure()))
        for k in keys:
            widget[k]
        # Test if OPTIONS contains all keys
        if test.test_support.verbose:
            aliases = {
                'bd': 'borderwidth',
                'bg': 'background',
                'fg': 'foreground',
                'invcmd': 'invalidcommand',
                'vcmd': 'validatecommand',
            }
            keys = set(keys)
            expected = set(self.OPTIONS)
            for k in sorted(keys - expected):
                if not (k in aliases and
                        aliases[k] in keys and
                        aliases[k] in expected):
                    print('%s.OPTIONS doesn\'t contain "%s"' %
                          (self.__class__.__name__, k))


class StandardOptionsTests(object):
    STANDARD_OPTIONS = (
        'activebackground', 'activeborderwidth', 'activeforeground', 'anchor',
        'background', 'bitmap', 'borderwidth', 'compound', 'cursor',
        'disabledforeground', 'exportselection', 'font', 'foreground',
        'highlightbackground', 'highlightcolor', 'highlightthickness',
        'image', 'insertbackground', 'insertborderwidth',
        'insertofftime', 'insertontime', 'insertwidth',
        'jump', 'justify', 'orient', 'padx', 'pady', 'relief',
        'repeatdelay', 'repeatinterval',
        'selectbackground', 'selectborderwidth', 'selectforeground',
        'setgrid', 'takefocus', 'text', 'textvariable', 'troughcolor',
        'underline', 'wraplength', 'xscrollcommand', 'yscrollcommand',
    )

    def test_activebackground(self):
        widget = self.create()
        self.checkColorParam(widget, 'activebackground')

    def test_activeborderwidth(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'activeborderwidth',
                              0, 1.3, 2.9, 6, -2, '10p')

    def test_activeforeground(self):
        widget = self.create()
        self.checkColorParam(widget, 'activeforeground')

    def test_anchor(self):
        widget = self.create()
        self.checkEnumParam(widget, 'anchor',
                'n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw', 'center')

    def test_background(self):
        widget = self.create()
        self.checkColorParam(widget, 'background')
        if 'bg' in self.OPTIONS:
            self.checkColorParam(widget, 'bg')

    def test_bitmap(self):
        widget = self.create()
        self.checkParam(widget, 'bitmap', 'questhead')
        self.checkParam(widget, 'bitmap', 'gray50')
        filename = test.test_support.findfile('python.xbm', subdir='imghdrdata')
        self.checkParam(widget, 'bitmap', '@' + filename)
        # Cocoa Tk widgets don't detect invalid -bitmap values
        # See https://core.tcl.tk/tk/info/31cd33dbf0
        if not ('aqua' in self.root.tk.call('tk', 'windowingsystem') and
                'AppKit' in self.root.winfo_server()):
            self.checkInvalidParam(widget, 'bitmap', 'spam',
                    errmsg='bitmap "spam" not defined')

    def test_borderwidth(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'borderwidth',
                              0, 1.3, 2.6, 6, -2, '10p')
        if 'bd' in self.OPTIONS:
            self.checkPixelsParam(widget, 'bd', 0, 1.3, 2.6, 6, -2, '10p')

    def test_compound(self):
        widget = self.create()
        self.checkEnumParam(widget, 'compound',
                'bottom', 'center', 'left', 'none', 'right', 'top')

    def test_cursor(self):
        widget = self.create()
        self.checkCursorParam(widget, 'cursor')

    def test_disabledforeground(self):
        widget = self.create()
        self.checkColorParam(widget, 'disabledforeground')

    def test_exportselection(self):
        widget = self.create()
        self.checkBooleanParam(widget, 'exportselection')

    def test_font(self):
        widget = self.create()
        self.checkParam(widget, 'font',
                        '-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*')
        self.checkInvalidParam(widget, 'font', '',
                               errmsg='font "" doesn\'t exist')

    def test_foreground(self):
        widget = self.create()
        self.checkColorParam(widget, 'foreground')
        if 'fg' in self.OPTIONS:
            self.checkColorParam(widget, 'fg')

    def test_highlightbackground(self):
        widget = self.create()
        self.checkColorParam(widget, 'highlightbackground')

    def test_highlightcolor(self):
        widget = self.create()
        self.checkColorParam(widget, 'highlightcolor')

    def test_highlightthickness(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'highlightthickness',
                              0, 1.3, 2.6, 6, '10p')
        self.checkParam(widget, 'highlightthickness', -2, expected=0,
                        conv=self._conv_pixels)

    @unittest.skipIf(sys.platform == 'darwin',
                     'crashes with Cocoa Tk (issue19733)')
    def test_image(self):
        widget = self.create()
        self.checkImageParam(widget, 'image')

    def test_insertbackground(self):
        widget = self.create()
        self.checkColorParam(widget, 'insertbackground')

    def test_insertborderwidth(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'insertborderwidth',
                              0, 1.3, 2.6, 6, -2, '10p')

    def test_insertofftime(self):
        widget = self.create()
        self.checkIntegerParam(widget, 'insertofftime', 100)

    def test_insertontime(self):
        widget = self.create()
        self.checkIntegerParam(widget, 'insertontime', 100)

    def test_insertwidth(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'insertwidth', 1.3, 2.6, -2, '10p')

    def test_jump(self):
        widget = self.create()
        self.checkBooleanParam(widget, 'jump')

    def test_justify(self):
        widget = self.create()
        self.checkEnumParam(widget, 'justify', 'left', 'right', 'center',
                errmsg='bad justification "{}": must be '
                       'left, right, or center')
        self.checkInvalidParam(widget, 'justify', '',
                errmsg='ambiguous justification "": must be '
                       'left, right, or center')

    def test_orient(self):
        widget = self.create()
        self.assertEqual(str(widget['orient']), self.default_orient)
        self.checkEnumParam(widget, 'orient', 'horizontal', 'vertical')

    def test_padx(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'padx', 3, 4.4, 5.6, -2, '12m',
                              conv=self._conv_pad_pixels)

    def test_pady(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'pady', 3, 4.4, 5.6, -2, '12m',
                              conv=self._conv_pad_pixels)

    def test_relief(self):
        widget = self.create()
        self.checkReliefParam(widget, 'relief')

    def test_repeatdelay(self):
        widget = self.create()
        self.checkIntegerParam(widget, 'repeatdelay', -500, 500)

    def test_repeatinterval(self):
        widget = self.create()
        self.checkIntegerParam(widget, 'repeatinterval', -500, 500)

    def test_selectbackground(self):
        widget = self.create()
        self.checkColorParam(widget, 'selectbackground')

    def test_selectborderwidth(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'selectborderwidth', 1.3, 2.6, -2, '10p')

    def test_selectforeground(self):
        widget = self.create()
        self.checkColorParam(widget, 'selectforeground')

    def test_setgrid(self):
        widget = self.create()
        self.checkBooleanParam(widget, 'setgrid')

    def test_state(self):
        widget = self.create()
        self.checkEnumParam(widget, 'state', 'active', 'disabled', 'normal')

    def test_takefocus(self):
        widget = self.create()
        self.checkParams(widget, 'takefocus', '0', '1', '')

    def test_text(self):
        widget = self.create()
        self.checkParams(widget, 'text', '', 'any string')

    def test_textvariable(self):
        widget = self.create()
        var = tkinter.StringVar(self.root)
        self.checkVariableParam(widget, 'textvariable', var)

    def test_troughcolor(self):
        widget = self.create()
        self.checkColorParam(widget, 'troughcolor')

    def test_underline(self):
        widget = self.create()
        self.checkIntegerParam(widget, 'underline', 0, 1, 10)

    def test_wraplength(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'wraplength', 100)

    def test_xscrollcommand(self):
        widget = self.create()
        self.checkCommandParam(widget, 'xscrollcommand')

    def test_yscrollcommand(self):
        widget = self.create()
        self.checkCommandParam(widget, 'yscrollcommand')

    # non-standard but common options

    def test_command(self):
        widget = self.create()
        self.checkCommandParam(widget, 'command')

    def test_indicatoron(self):
        widget = self.create()
        self.checkBooleanParam(widget, 'indicatoron')

    def test_offrelief(self):
        widget = self.create()
        self.checkReliefParam(widget, 'offrelief')

    def test_overrelief(self):
        widget = self.create()
        self.checkReliefParam(widget, 'overrelief')

    def test_selectcolor(self):
        widget = self.create()
        self.checkColorParam(widget, 'selectcolor')

    def test_selectimage(self):
        widget = self.create()
        self.checkImageParam(widget, 'selectimage')

    @requires_tcl(8, 5)
    def test_tristateimage(self):
        widget = self.create()
        self.checkImageParam(widget, 'tristateimage')

    @requires_tcl(8, 5)
    def test_tristatevalue(self):
        widget = self.create()
        self.checkParam(widget, 'tristatevalue', 'unknowable')

    def test_variable(self):
        widget = self.create()
        var = tkinter.DoubleVar(self.root)
        self.checkVariableParam(widget, 'variable', var)


class IntegerSizeTests(object):
    def test_height(self):
        widget = self.create()
        self.checkIntegerParam(widget, 'height', 100, -100, 0)

    def test_width(self):
        widget = self.create()
        self.checkIntegerParam(widget, 'width', 402, -402, 0)


class PixelSizeTests(object):
    def test_height(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'height', 100, 101.2, 102.6, -100, 0, '3c')

    def test_width(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'width', 402, 403.4, 404.6, -402, 0, '5i')


def add_standard_options(*source_classes):
    # This decorator adds test_xxx methods from source classes for every xxx
    # option in the OPTIONS class attribute if they are not defined explicitly.
    def decorator(cls):
        for option in cls.OPTIONS:
            methodname = 'test_' + option
            if not hasattr(cls, methodname):
                for source_class in source_classes:
                    if hasattr(source_class, methodname):
                        setattr(cls, methodname,
                                getattr(source_class, methodname).im_func)
                        break
                else:
                    def test(self, option=option):
                        widget = self.create()
                        widget[option]
                        raise AssertionError('Option "%s" is not tested in %s' %
                                             (option, cls.__name__))
                    test.__name__ = methodname
                    setattr(cls, methodname, test)
        return cls
    return decorator

def setUpModule():
    if test.test_support.verbose:
        tcl = tkinter.Tcl()
        print 'patchlevel =', tcl.call('info', 'patchlevel')
README000064400000001066150351526560005437 0ustar00Writing new tests
=================

Precaution
----------

    New tests should always use only one Tk window at once, like all the
    current tests do. This means that you have to destroy the current window
    before creating another one, and clean up after the test. The motivation
    behind this is that some tests may depend on having its window focused
    while it is running to work properly, and it may be hard to force focus
    on your window across platforms (right now only test_traversal at
    test_ttk.test_widgets.NotebookTest depends on this).

widget_tests.pyc000064400000063575150351526570010017 0ustar00�
zfc@sVddlZddlZddlZddlmZddlmZmZm	Z	m
Z
mZmZddl
ZeZZe
�dddfkr�eZneo�ee�Zd�ZeZe
�d dddfkr�eZne�Zd	efd
��YZdefd��YZd
efd��YZdefd��YZd�Zd�ZdS(i����N(tScale(tAbstractTkTestttcl_versiontrequires_tcltget_tk_patchleveltpixels_convt
tcl_obj_eqiiicCstt|��S(N(tinttround(tx((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt	int_roundsitAbstractWidgetTestcBs�eZee�ZdZeZe	d��Z
d�Zdej
d�Zeedd�Zded�Zd�Zd�Zd�Zd�Zdd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Z RS(cCsEy|jSWn3tk
r@t|jjdd��|_|jSXdS(Nttktscaling(t_scalingtAttributeErrortfloattroottcall(tself((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyR
"s

cCsU|jr#|jr#tdkr#|St|t�rKdjt|j|��St|�S(Niit (ii(	t
_stringifytwantobjectsRt
isinstancettupletjointmapt_strtstr(Rtvalue((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyR*s
cCs*|||�rdS|j|||�dS(N(tassertEqual(Rtactualtexpectedtmsgteq((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytassertEqual21scCs|||<|tkr|}n|r4||�}n|jsG|jrwt|t�rhtj|�}qwt|�}n|dkr�t	}n|j
|||d|�|j
|j|�|d|�t|t�s|j
|�}|jt|�d�|j
|d|d|�ndS(NR"ii(t	_sentinelRRRRttkintert_joinRtNoneRR#tcgetRt	configureRtlen(RtwidgettnameRR tconvR"tt((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt
checkParam6s"
		c	Cs||}|dk	r(|j|�}n|jtj��}|||<WdQX|dk	ru|jt|j�|�n|r�|j|||�n
|||<|jtj��}|ji||6�WdQX|dk	r�|jt|j�|�n|r|j|||�n
|||<dS(N(	R'tformattassertRaisesR%tTclErrorRRt	exceptionR)(RR+R,Rterrmsgt	keep_origtorigtcm((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckInvalidParamLs"

cOs+x$|D]}|j||||�qWdS(N(R/(RR+R,tvaluestkwargsR((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckParamsbs
cOse|j||||�|j||ddd�|j||ddd�|j||ddd�dS(NtR4sexpected integer but got ""t10psexpected integer but got "10p"g������	@sexpected integer but got "3.2"(R;R8(RR+R,R9R:((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckIntegerParamfscOs�d|kr|jd�}nt}x*|D]"}|j|||d||�q+W|j||ddd�|j||ddd�dS(NR-R<R4s)expected floating-point number but got ""tspams-expected floating-point number but got "spam"(tpopRR/R8(RR+R,R9R:R-R((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckFloatParamos
 cCs�x6tddddfD]}|j|||dd�qWx6tdddd	fD]}|j|||dd�qOW|j||d
dd�|j||d
dd�dS(NitfalsetnotoffR ittruetyestonR<R4s!expected boolean value but got ""R?s%expected boolean value but got "spam"(tFalseR/tTrueR8(RR+R,R((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckBooleanParam{scKsN|j||ddddddddd	d
|�|j||ddd
�dS(Ns#ff0000s#00ff00s#0000ffs#123456tredtgreentbluetwhitetblacktgreyR?R4sunknown color name "spam"(R;R8(RR+R,tallow_emptyR:((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckColorParam�scKs^|j||dddd|�tdkrA|j||d�n|j||dd	d
�dS(NtarrowtwatchtcrossR<iitnoneR?R4sbad cursor spec "spam"(ii(R;RR/R8(RR+R,R:((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckCursorParam�s
cCs;d�}|||<|j||�|j||d�dS(NcWsdS(N((targs((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcommand�sR<(t
assertTrueR;(RR+R,RY((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckCommandParam�s	
cOs�d|kr|jd�}nd}|j||||�|dkr�d|dj|d �t|�dkrtdnd|df}|j||ddd|�d	|}n|j||d
d|�dS(NR4s %s "{}": must be %s%s or %ss, i����it,R<t	ambiguoustbadR?(R@R'R;RR*R8(RR+R,R9R:R4terrmsg2((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckEnumParam�s
c

Os!d|kr|jd�}nd}|dkr<|j}nd|krZ|jd�}nt}x||D]t}t}|}	t|t�r�|	r�|	tk	r�t|�|j}t	}	q�n|j
|||d|d|	|�qgW|j||dddd|�|j||dddd|�dS(	NR-R5R t6xR4sbad screen distance "6x"R?sbad screen distance "spam"(R@R't_conv_pixelsRIR$RRRR
R
R/R8(
RR+R,R9R:R-R5RR tconv1((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckPixelsParam�s*

c	CsZ|j||dddddd�d}tdkr=d}n|j||d
d|�dS(
NtflattgroovetraisedtridgetsolidtsunkensHbad relief "spam": must be flat, groove, raised, ridge, solid, or sunkeniiR?R4(ii(R;RR'R8(RR+R,R4((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckReliefParam�s	cCs[tjd|jdd�}|j|||dt�|j||ddd�d||<dS(	NtmasterR,timage1R-R?R4simage "spam" doesn't existR<(R%t
PhotoImageRR/RR8(RR+R,timage((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckImageParam�s
cCs|j|||dt�dS(NR-(R/R(RR+R,tvar((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytcheckVariableParam�scCs�|j|�|j|t�t|�dkrF|jd|f�nx5|D]-}t|t�sM|jd|f�PqMqMWdS(NisInvalid bounding box: %r(tassertIsNotNonetassertIsInstanceRR*tfailRR(Rtbboxtitem((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytassertIsBoundingBox�s

cCs|j�}|j�}t|t�sL|jt|�t|j���nx|D]}||qSWtjj	ridd6dd6dd6dd6d	d
6}t
|�}t
|j�}x_t||�D]J}||ko�|||ko�|||ks�d|jj
|fGHq�q�WndS(Ntborderwidthtbdt
backgroundtbgt
foregroundtfgtinvalidcommandtinvcmdtvalidatecommandtvcmds%s.OPTIONS doesn't contain "%s"(tcreatetkeysRRRtsortedR)ttestttest_supporttverbosetsettOPTIONSt	__class__t__name__(RR+R�tktaliasesR ((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt	test_keys�s*%

N(!R�t
__module__tstaticmethodtpixels_roundRbR't_conv_pad_pixelsRHRtpropertyR
Rtobjectt__eq__R#R$R/RIR8R;R>RARJRRRWR[R`RdRkRpRrRxR�(((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyRs0						
					
			
tStandardOptionsTestsc*BseZdbZd*�Zd+�Zd,�Zd-�Zd.�Zd/�Zd0�Z	d1�Z
d2�Zd3�Zd4�Z
d5�Zd6�Zd7�Zd8�Zd9�Zejejd:kd;�d<��Zd=�Zd>�Zd?�Zd@�ZdA�ZdB�ZdC�ZdD�ZdE�Z dF�Z!dG�Z"dH�Z#dI�Z$dJ�Z%dK�Z&dL�Z'dM�Z(dN�Z)dO�Z*dP�Z+dQ�Z,dR�Z-dS�Z.dT�Z/dU�Z0dV�Z1dW�Z2dX�Z3dY�Z4dZ�Z5d[�Z6d\�Z7e8d]d^�d_��Z9e8d]d^�d`��Z:da�Z;RS(ctactivebackgroundtactiveborderwidthtactiveforegroundtanchorR{tbitmapRytcompoundtcursortdisabledforegroundtexportselectiontfontR}thighlightbackgroundthighlightcolorthighlightthicknessRotinsertbackgroundtinsertborderwidtht
insertofftimetinsertontimetinsertwidthtjumptjustifytorienttpadxtpadytrelieftrepeatdelaytrepeatintervaltselectbackgroundtselectborderwidthtselectforegroundtsetgridt	takefocusttextttextvariablettroughcolort	underlinet
wraplengthtxscrollcommandtyscrollcommandcCs |j�}|j|d�dS(NR�(R�RR(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_activebackground
sc	Cs2|j�}|j|ddddddd�dS(NR�ig�������?g333333@ii����R=(R�Rd(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_activeborderwidthscCs |j�}|j|d�dS(NR�(R�RR(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_activeforegroundscCs;|j�}|j|ddddddddd	d
�dS(NR�tntnetetsetstswtwtnwtcenter(R�R`(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_anchorscCsB|j�}|j|d�d|jkr>|j|d�ndS(NR{R|(R�RRR�(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_backgroundscCs�|j�}|j|dd�|j|dd�tjjddd�}|j|dd|�d|jjjd	d
�ko�d|jj�ks�|j	|ddd
d�ndS(NR�t	questheadtgray50s
python.xbmtsubdirt
imghdrdatat@taquaRtwindowingsystemtAppKitR?R4sbitmap "spam" not defined(
R�R/R�R�tfindfileRRRtwinfo_serverR8(RR+tfilename((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_bitmap%sc	Csf|j�}|j|ddddddd�d|jkrb|j|ddddddd�ndS(	NRyig�������?g������@ii����R=Rz(R�RdR�(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_borderwidth2s
c	Cs2|j�}|j|ddddddd�dS(NR�tbottomR�tleftRVtrightttop(R�R`(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt
test_compound9scCs |j�}|j|d�dS(NR�(R�RW(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_cursor>scCs |j�}|j|d�dS(NR�(R�RR(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_disabledforegroundBscCs |j�}|j|d�dS(NR�(R�RJ(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_exportselectionFscCs<|j�}|j|dd�|j|dddd�dS(NR�s3-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*R<R4sfont "" doesn't exist(R�R/R8(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt	test_fontJs
cCsB|j�}|j|d�d|jkr>|j|d�ndS(NR}R~(R�RRR�(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_foregroundQscCs |j�}|j|d�dS(NR�(R�RR(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_highlightbackgroundWscCs |j�}|j|d�dS(NR�(R�RR(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_highlightcolor[scCsQ|j�}|j|dddddd�|j|ddddd	|j�dS(
NR�ig�������?g������@iR=i����R R-(R�RdR/Rb(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_highlightthickness_s
tdarwins"crashes with Cocoa Tk (issue19733)cCs |j�}|j|d�dS(NRo(R�Rp(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt
test_imagefscCs |j�}|j|d�dS(NR�(R�RR(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_insertbackgroundlsc	Cs2|j�}|j|ddddddd�dS(NR�ig�������?g������@ii����R=(R�Rd(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_insertborderwidthpscCs#|j�}|j|dd�dS(NR�id(R�R>(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_insertofftimeuscCs#|j�}|j|dd�dS(NR�id(R�R>(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_insertontimeyscCs,|j�}|j|ddddd�dS(NR�g�������?g������@i����R=(R�Rd(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_insertwidth}scCs |j�}|j|d�dS(NR�(R�RJ(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt	test_jump�scCsH|j�}|j|dddddd�|j|dddd�dS(	NR�R�R�R�R4s6bad justification "{}": must be left, right, or centerR<s:ambiguous justification "": must be left, right, or center(R�R`R8(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_justify�s
cCsC|j�}|jt|d�|j�|j|ddd�dS(NR�t
horizontaltvertical(R�RRtdefault_orientR`(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_orient�sc
Cs8|j�}|j|ddddddd|j�dS(NR�ig������@gffffff@i����t12mR-(R�RdR�(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt	test_padx�sc
Cs8|j�}|j|ddddddd|j�dS(NR�ig������@gffffff@i����R�R-(R�RdR�(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt	test_pady�scCs |j�}|j|d�dS(NR�(R�Rk(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_relief�scCs&|j�}|j|ddd�dS(NR�i���i�(R�R>(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_repeatdelay�scCs&|j�}|j|ddd�dS(NR�i���i�(R�R>(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_repeatinterval�scCs |j�}|j|d�dS(NR�(R�RR(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_selectbackground�scCs,|j�}|j|ddddd�dS(NR�g�������?g������@i����R=(R�Rd(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_selectborderwidth�scCs |j�}|j|d�dS(NR�(R�RR(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_selectforeground�scCs |j�}|j|d�dS(NR�(R�RJ(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_setgrid�scCs)|j�}|j|dddd�dS(Ntstatetactivetdisabledtnormal(R�R`(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt
test_state�scCs)|j�}|j|dddd�dS(NR�t0t1R<(R�R;(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_takefocus�scCs&|j�}|j|ddd�dS(NR�R<s
any string(R�R;(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt	test_text�scCs5|j�}tj|j�}|j|d|�dS(NR�(R�R%t	StringVarRRr(RR+Rq((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_textvariable�scCs |j�}|j|d�dS(NR�(R�RR(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_troughcolor�scCs)|j�}|j|dddd�dS(NR�iii
(R�R>(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_underline�scCs#|j�}|j|dd�dS(NR�id(R�Rd(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_wraplength�scCs |j�}|j|d�dS(NR�(R�R[(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_xscrollcommand�scCs |j�}|j|d�dS(NR�(R�R[(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_yscrollcommand�scCs |j�}|j|d�dS(NRY(R�R[(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_command�scCs |j�}|j|d�dS(Ntindicatoron(R�RJ(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_indicatoron�scCs |j�}|j|d�dS(Nt	offrelief(R�Rk(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_offrelief�scCs |j�}|j|d�dS(Nt
overrelief(R�Rk(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_overrelief�scCs |j�}|j|d�dS(Ntselectcolor(R�RR(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_selectcolor�scCs |j�}|j|d�dS(Ntselectimage(R�Rp(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_selectimage�siicCs |j�}|j|d�dS(Nt
tristateimage(R�Rp(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_tristateimage�scCs#|j�}|j|dd�dS(Nt
tristatevaluet
unknowable(R�R/(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_tristatevalue�scCs5|j�}tj|j�}|j|d|�dS(Ntvariable(R�R%t	DoubleVarRRr(RR+Rq((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt
test_variables(*R�R�R�R�R{R�RyR�R�R�R�R�R}R�R�R�RoR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�(<R�R�tSTANDARD_OPTIONSR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�tunittesttskipIftsystplatformR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�RRRRRR	R
RRR
RRRRRRRRR(((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyR��s�						
																																											tIntegerSizeTestscBseZd�Zd�ZRS(cCs)|j�}|j|dddd�dS(Ntheightidi����i(R�R>(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyttest_height	scCs)|j�}|j|dddd�dS(Ntwidthi�in���i(R�R>(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt
test_width
s(R�R�R'R)(((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyR%s	tPixelSizeTestscBseZd�Zd�ZRS(c	Cs2|j�}|j|ddddddd�dS(NR&idg�����LY@gfffff�Y@i����it3c(R�Rd(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyR'sc	Cs2|j�}|j|ddddddd�dS(NR(i�gfffff6y@g�����Iy@in���it5i(R�Rd(RR+((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyR)s(R�R�R'R)(((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyR*s	cs�fd�}|S(Ncs�x��jD]�}d|}t�|�s
xk�D]5}t||�r0t�|t||�j�Pq0q0W|�fd�}||_t�||�q
q
W�S(Nttest_cs1|j�}||td|�jf��dS(NsOption "%s" is not tested in %s(R�tAssertionErrorR�(RtoptionR+(tcls(s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyR�)s(R�thasattrtsetattrtgetattrtim_funcR�(R0R/t
methodnametsource_classR�(tsource_classes(R0s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt	decorators

		((R7R8((R7s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytadd_standard_optionsscCs4tjjr0tj�}dG|jdd�GHndS(Nspatchlevel =tinfot
patchlevel(R�R�R�R%tTclR(ttcl((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pytsetUpModule3s(R!R#tTkinterR%tttkRttest_ttk.supportRRRRRRttest.test_supportR�RHtnoconvtnoconv_methRR�R
R�RR�R$RR�R%R*R9R>(((s0/usr/lib64/python2.7/lib-tk/test/widget_tests.pyt<module>s*.
				��

	runtktests.pyc000064400000005453150351526570007527 0ustar00�
zfc@s�dZddlZddlZddlZddlZddlZejjejj	e
��Zd�Zee
dd�Ze
e
dd�Zedkr�ejje��ndS(s�
Use this module to get and run all tk tests.

Tkinter tests should live in a package inside the directory where this file
lives, like test_tkinter.
Extensions also should live in packages following the same rule as above.
i����NcCs.x'tj|�D]}|dkrtSqWtS(Ns__init__.pys__init__.pycs
__init.pyo(s__init__.pys__init__.pycs
__init.pyo(tostlistdirtTruetFalse(tpathtname((s./usr/lib64/python2.7/lib-tk/test/runtktests.pyt
is_packagesc	#s-d�x tj|�D]\}}}x4t|�D]&}|ddkr2|j|�q2q2Wt|�r|r|t|�ttj�jdd�}|r�||kr�qnt�fd�|�}x[|D]P}y$t	j
d|t�� |�VWq�tjj
k
r|r�qq�Xq�WqqWdS(s�This will import and yield modules whose names start with test_
    and are inside packages found in the path starting at basepath.

    If packages is specified it should contain package names that want
    their tests collected.
    s.pyit.t/cs|jd�o|j��S(Nttest_(t
startswithtendswith(tx(tpy_ext(s./usr/lib64/python2.7/lib-tk/test/runtktests.pyt<lambda>+ts.%sN(RtwalktlisttremoveRtlentseptreplacetfiltert	importlibt
import_modulettestttest_supporttResourceDenied(	tbasepathtguitpackagestdirpathtdirnamest	filenamestdirnametpkg_nameR((R
s./usr/lib64/python2.7/lib-tk/test/runtktests.pytget_tests_moduless&)	
ccs�g}|r|jd�n|r2|jd�nxPtd|d|�D]9}x0|D](}xt||d�D]}|VqnWqUWqHWdS(s�Yield all the tests in the modules found by get_tests_modules.

    If nogui is True, only tests that do not require a GUI will be
    returned.ttests_noguit	tests_guiRRN((tappendR$tgetattr(ttextRRtattrstmoduletattrR((s./usr/lib64/python2.7/lib-tk/test/runtktests.pyt	get_tests6s
t__main__(t__doc__RtsystunittestRttest.test_supportRRtabspathR"t__file__t
this_dir_pathRRtNoneR$R-t__name__Rtrun_unittest(((s./usr/lib64/python2.7/lib-tk/test/runtktests.pyt<module>s	test_ttk/test_widgets.py000064400000166617150351526570011516 0ustar00import unittest
import Tkinter as tkinter
from Tkinter import TclError
import ttk
from test.test_support import requires, run_unittest, have_unicode, u
import sys

from test_functions import MockTclObj
from support import (AbstractTkTest, tcl_version, get_tk_patchlevel,
                     simulate_mouse_click)
from widget_tests import (add_standard_options, noconv, noconv_meth,
    AbstractWidgetTest, StandardOptionsTests,
    IntegerSizeTests, PixelSizeTests,
    setUpModule)

requires('gui')


class StandardTtkOptionsTests(StandardOptionsTests):

    def test_class(self):
        widget = self.create()
        self.assertEqual(widget['class'], '')
        errmsg='attempt to change read-only option'
        if get_tk_patchlevel() < (8, 6, 0, 'beta', 3):
            errmsg='Attempt to change read-only option'
        self.checkInvalidParam(widget, 'class', 'Foo', errmsg=errmsg)
        widget2 = self.create(class_='Foo')
        self.assertEqual(widget2['class'], 'Foo')

    def test_padding(self):
        widget = self.create()
        self.checkParam(widget, 'padding', 0, expected=('0',))
        self.checkParam(widget, 'padding', 5, expected=('5',))
        self.checkParam(widget, 'padding', (5, 6), expected=('5', '6'))
        self.checkParam(widget, 'padding', (5, 6, 7),
                        expected=('5', '6', '7'))
        self.checkParam(widget, 'padding', (5, 6, 7, 8),
                        expected=('5', '6', '7', '8'))
        self.checkParam(widget, 'padding', ('5p', '6p', '7p', '8p'))
        self.checkParam(widget, 'padding', (), expected='')

    def test_style(self):
        widget = self.create()
        self.assertEqual(widget['style'], '')
        errmsg = 'Layout Foo not found'
        if hasattr(self, 'default_orient'):
            errmsg = ('Layout %s.Foo not found' %
                      getattr(self, 'default_orient').title())
        self.checkInvalidParam(widget, 'style', 'Foo',
                errmsg=errmsg)
        widget2 = self.create(class_='Foo')
        self.assertEqual(widget2['class'], 'Foo')
        # XXX
        pass


class WidgetTest(AbstractTkTest, unittest.TestCase):
    """Tests methods available in every ttk widget."""

    def setUp(self):
        super(WidgetTest, self).setUp()
        self.widget = ttk.Button(self.root, width=0, text="Text")
        self.widget.pack()
        self.widget.wait_visibility()


    def test_identify(self):
        self.widget.update_idletasks()
        self.assertEqual(self.widget.identify(
            self.widget.winfo_width() // 2,
            self.widget.winfo_height() // 2
            ), "label")
        self.assertEqual(self.widget.identify(-1, -1), "")

        self.assertRaises(tkinter.TclError, self.widget.identify, None, 5)
        self.assertRaises(tkinter.TclError, self.widget.identify, 5, None)
        self.assertRaises(tkinter.TclError, self.widget.identify, 5, '')


    def test_widget_state(self):
        # XXX not sure about the portability of all these tests
        self.assertEqual(self.widget.state(), ())
        self.assertEqual(self.widget.instate(['!disabled']), True)

        # changing from !disabled to disabled
        self.assertEqual(self.widget.state(['disabled']), ('!disabled', ))
        # no state change
        self.assertEqual(self.widget.state(['disabled']), ())
        # change back to !disable but also active
        self.assertEqual(self.widget.state(['!disabled', 'active']),
            ('!active', 'disabled'))
        # no state changes, again
        self.assertEqual(self.widget.state(['!disabled', 'active']), ())
        self.assertEqual(self.widget.state(['active', '!disabled']), ())

        def test_cb(arg1, **kw):
            return arg1, kw
        self.assertEqual(self.widget.instate(['!disabled'],
            test_cb, "hi", **{"msg": "there"}),
            ('hi', {'msg': 'there'}))

        # attempt to set invalid statespec
        currstate = self.widget.state()
        self.assertRaises(tkinter.TclError, self.widget.instate,
            ['badstate'])
        self.assertRaises(tkinter.TclError, self.widget.instate,
            ['disabled', 'badstate'])
        # verify that widget didn't change its state
        self.assertEqual(currstate, self.widget.state())

        # ensuring that passing None as state doesn't modify current state
        self.widget.state(['active', '!disabled'])
        self.assertEqual(self.widget.state(), ('active', ))


class AbstractToplevelTest(AbstractWidgetTest, PixelSizeTests):
    _conv_pixels = noconv_meth


@add_standard_options(StandardTtkOptionsTests)
class FrameTest(AbstractToplevelTest, unittest.TestCase):
    OPTIONS = (
        'borderwidth', 'class', 'cursor', 'height',
        'padding', 'relief', 'style', 'takefocus',
        'width',
    )

    def create(self, **kwargs):
        return ttk.Frame(self.root, **kwargs)


@add_standard_options(StandardTtkOptionsTests)
class LabelFrameTest(AbstractToplevelTest, unittest.TestCase):
    OPTIONS = (
        'borderwidth', 'class', 'cursor', 'height',
        'labelanchor', 'labelwidget',
        'padding', 'relief', 'style', 'takefocus',
        'text', 'underline', 'width',
    )

    def create(self, **kwargs):
        return ttk.LabelFrame(self.root, **kwargs)

    def test_labelanchor(self):
        widget = self.create()
        self.checkEnumParam(widget, 'labelanchor',
                'e', 'en', 'es', 'n', 'ne', 'nw', 's', 'se', 'sw', 'w', 'wn', 'ws',
                errmsg='Bad label anchor specification {}')
        self.checkInvalidParam(widget, 'labelanchor', 'center')

    def test_labelwidget(self):
        widget = self.create()
        label = ttk.Label(self.root, text='Mupp', name='foo')
        self.checkParam(widget, 'labelwidget', label, expected='.foo')
        label.destroy()


class AbstractLabelTest(AbstractWidgetTest):

    def checkImageParam(self, widget, name):
        image = tkinter.PhotoImage(master=self.root, name='image1')
        image2 = tkinter.PhotoImage(master=self.root, name='image2')
        self.checkParam(widget, name, image, expected=('image1',))
        self.checkParam(widget, name, 'image1', expected=('image1',))
        self.checkParam(widget, name, (image,), expected=('image1',))
        self.checkParam(widget, name, (image, 'active', image2),
                        expected=('image1', 'active', 'image2'))
        self.checkParam(widget, name, 'image1 active image2',
                        expected=('image1', 'active', 'image2'))
        self.checkInvalidParam(widget, name, 'spam',
                errmsg='image "spam" doesn\'t exist')

    def test_compound(self):
        widget = self.create()
        self.checkEnumParam(widget, 'compound',
                'none', 'text', 'image', 'center',
                'top', 'bottom', 'left', 'right')

    def test_state(self):
        widget = self.create()
        self.checkParams(widget, 'state', 'active', 'disabled', 'normal')

    def test_width(self):
        widget = self.create()
        self.checkParams(widget, 'width', 402, -402, 0)


@add_standard_options(StandardTtkOptionsTests)
class LabelTest(AbstractLabelTest, unittest.TestCase):
    OPTIONS = (
        'anchor', 'background', 'borderwidth',
        'class', 'compound', 'cursor', 'font', 'foreground',
        'image', 'justify', 'padding', 'relief', 'state', 'style',
        'takefocus', 'text', 'textvariable',
        'underline', 'width', 'wraplength',
    )
    _conv_pixels = noconv_meth

    def create(self, **kwargs):
        return ttk.Label(self.root, **kwargs)

    def test_font(self):
        widget = self.create()
        self.checkParam(widget, 'font',
                        '-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*')


@add_standard_options(StandardTtkOptionsTests)
class ButtonTest(AbstractLabelTest, unittest.TestCase):
    OPTIONS = (
        'class', 'command', 'compound', 'cursor', 'default',
        'image', 'padding', 'state', 'style',
        'takefocus', 'text', 'textvariable',
        'underline', 'width',
    )

    def create(self, **kwargs):
        return ttk.Button(self.root, **kwargs)

    def test_default(self):
        widget = self.create()
        self.checkEnumParam(widget, 'default', 'normal', 'active', 'disabled')

    def test_invoke(self):
        success = []
        btn = ttk.Button(self.root, command=lambda: success.append(1))
        btn.invoke()
        self.assertTrue(success)


@add_standard_options(StandardTtkOptionsTests)
class CheckbuttonTest(AbstractLabelTest, unittest.TestCase):
    OPTIONS = (
        'class', 'command', 'compound', 'cursor',
        'image',
        'offvalue', 'onvalue',
        'padding', 'state', 'style',
        'takefocus', 'text', 'textvariable',
        'underline', 'variable', 'width',
    )

    def create(self, **kwargs):
        return ttk.Checkbutton(self.root, **kwargs)

    def test_offvalue(self):
        widget = self.create()
        self.checkParams(widget, 'offvalue', 1, 2.3, '', 'any string')

    def test_onvalue(self):
        widget = self.create()
        self.checkParams(widget, 'onvalue', 1, 2.3, '', 'any string')

    def test_invoke(self):
        success = []
        def cb_test():
            success.append(1)
            return "cb test called"

        cbtn = ttk.Checkbutton(self.root, command=cb_test)
        # the variable automatically created by ttk.Checkbutton is actually
        # undefined till we invoke the Checkbutton
        self.assertEqual(cbtn.state(), ('alternate', ))
        self.assertRaises(tkinter.TclError, cbtn.tk.globalgetvar,
            cbtn['variable'])

        res = cbtn.invoke()
        self.assertEqual(res, "cb test called")
        self.assertEqual(cbtn['onvalue'],
            cbtn.tk.globalgetvar(cbtn['variable']))
        self.assertTrue(success)

        cbtn['command'] = ''
        res = cbtn.invoke()
        self.assertFalse(str(res))
        self.assertLessEqual(len(success), 1)
        self.assertEqual(cbtn['offvalue'],
            cbtn.tk.globalgetvar(cbtn['variable']))


@add_standard_options(IntegerSizeTests, StandardTtkOptionsTests)
class EntryTest(AbstractWidgetTest, unittest.TestCase):
    OPTIONS = (
        'background', 'class', 'cursor',
        'exportselection', 'font', 'foreground',
        'invalidcommand', 'justify',
        'show', 'state', 'style', 'takefocus', 'textvariable',
        'validate', 'validatecommand', 'width', 'xscrollcommand',
    )

    def setUp(self):
        super(EntryTest, self).setUp()
        self.entry = self.create()

    def create(self, **kwargs):
        return ttk.Entry(self.root, **kwargs)

    def test_invalidcommand(self):
        widget = self.create()
        self.checkCommandParam(widget, 'invalidcommand')

    def test_show(self):
        widget = self.create()
        self.checkParam(widget, 'show', '*')
        self.checkParam(widget, 'show', '')
        self.checkParam(widget, 'show', ' ')

    def test_state(self):
        widget = self.create()
        self.checkParams(widget, 'state',
                         'disabled', 'normal', 'readonly')

    def test_validate(self):
        widget = self.create()
        self.checkEnumParam(widget, 'validate',
                'all', 'key', 'focus', 'focusin', 'focusout', 'none')

    def test_validatecommand(self):
        widget = self.create()
        self.checkCommandParam(widget, 'validatecommand')


    def test_bbox(self):
        self.assertIsBoundingBox(self.entry.bbox(0))
        self.assertRaises(tkinter.TclError, self.entry.bbox, 'noindex')
        self.assertRaises(tkinter.TclError, self.entry.bbox, None)


    def test_identify(self):
        self.entry.pack()
        self.entry.wait_visibility()
        self.entry.update_idletasks()

        # bpo-27313: macOS Cocoa widget differs from X, allow either
        if sys.platform == 'darwin':
            self.assertIn(self.entry.identify(5, 5),
                ("textarea", "Combobox.button") )
        else:
            self.assertEqual(self.entry.identify(5, 5), "textarea")
        self.assertEqual(self.entry.identify(-1, -1), "")

        self.assertRaises(tkinter.TclError, self.entry.identify, None, 5)
        self.assertRaises(tkinter.TclError, self.entry.identify, 5, None)
        self.assertRaises(tkinter.TclError, self.entry.identify, 5, '')


    def test_validation_options(self):
        success = []
        test_invalid = lambda: success.append(True)

        self.entry['validate'] = 'none'
        self.entry['validatecommand'] = lambda: False

        self.entry['invalidcommand'] = test_invalid
        self.entry.validate()
        self.assertTrue(success)

        self.entry['invalidcommand'] = ''
        self.entry.validate()
        self.assertEqual(len(success), 1)

        self.entry['invalidcommand'] = test_invalid
        self.entry['validatecommand'] = lambda: True
        self.entry.validate()
        self.assertEqual(len(success), 1)

        self.entry['validatecommand'] = ''
        self.entry.validate()
        self.assertEqual(len(success), 1)

        self.entry['validatecommand'] = True
        self.assertRaises(tkinter.TclError, self.entry.validate)


    def test_validation(self):
        validation = []
        def validate(to_insert):
            if not 'a' <= to_insert.lower() <= 'z':
                validation.append(False)
                return False
            validation.append(True)
            return True

        self.entry['validate'] = 'key'
        self.entry['validatecommand'] = self.entry.register(validate), '%S'

        self.entry.insert('end', 1)
        self.entry.insert('end', 'a')
        self.assertEqual(validation, [False, True])
        self.assertEqual(self.entry.get(), 'a')


    def test_revalidation(self):
        def validate(content):
            for letter in content:
                if not 'a' <= letter.lower() <= 'z':
                    return False
            return True

        self.entry['validatecommand'] = self.entry.register(validate), '%P'

        self.entry.insert('end', 'avocado')
        self.assertEqual(self.entry.validate(), True)
        self.assertEqual(self.entry.state(), ())

        self.entry.delete(0, 'end')
        self.assertEqual(self.entry.get(), '')

        self.entry.insert('end', 'a1b')
        self.assertEqual(self.entry.validate(), False)
        self.assertEqual(self.entry.state(), ('invalid', ))

        self.entry.delete(1)
        self.assertEqual(self.entry.validate(), True)
        self.assertEqual(self.entry.state(), ())


@add_standard_options(IntegerSizeTests, StandardTtkOptionsTests)
class ComboboxTest(EntryTest, unittest.TestCase):
    OPTIONS = (
        'background', 'class', 'cursor', 'exportselection',
        'font', 'foreground', 'height', 'invalidcommand',
        'justify', 'postcommand', 'show', 'state', 'style',
        'takefocus', 'textvariable',
        'validate', 'validatecommand', 'values',
        'width', 'xscrollcommand',
    )

    def setUp(self):
        super(ComboboxTest, self).setUp()
        self.combo = self.create()

    def create(self, **kwargs):
        return ttk.Combobox(self.root, **kwargs)

    def test_height(self):
        widget = self.create()
        self.checkParams(widget, 'height', 100, 101.2, 102.6, -100, 0, '1i')

    def _show_drop_down_listbox(self):
        width = self.combo.winfo_width()
        self.combo.event_generate('<ButtonPress-1>', x=width - 5, y=5)
        self.combo.event_generate('<ButtonRelease-1>', x=width - 5, y=5)
        self.combo.update_idletasks()


    def test_virtual_event(self):
        success = []

        self.combo['values'] = [1]
        self.combo.bind('<<ComboboxSelected>>',
            lambda evt: success.append(True))
        self.combo.pack()
        self.combo.wait_visibility()

        height = self.combo.winfo_height()
        self._show_drop_down_listbox()
        self.combo.update()
        self.combo.event_generate('<Return>')
        self.combo.update()

        self.assertTrue(success)


    def test_postcommand(self):
        success = []

        self.combo['postcommand'] = lambda: success.append(True)
        self.combo.pack()
        self.combo.wait_visibility()

        self._show_drop_down_listbox()
        self.assertTrue(success)

        # testing postcommand removal
        self.combo['postcommand'] = ''
        self._show_drop_down_listbox()
        self.assertEqual(len(success), 1)


    def test_values(self):
        def check_get_current(getval, currval):
            self.assertEqual(self.combo.get(), getval)
            self.assertEqual(self.combo.current(), currval)

        self.assertEqual(self.combo['values'],
                         () if tcl_version < (8, 5) else '')
        check_get_current('', -1)

        self.checkParam(self.combo, 'values', 'mon tue wed thur',
                        expected=('mon', 'tue', 'wed', 'thur'))
        self.checkParam(self.combo, 'values', ('mon', 'tue', 'wed', 'thur'))
        self.checkParam(self.combo, 'values', (42, 3.14, '', 'any string'))
        self.checkParam(self.combo, 'values', () if tcl_version < (8, 5) else '')

        self.combo['values'] = ['a', 1, 'c']

        self.combo.set('c')
        check_get_current('c', 2)

        self.combo.current(0)
        check_get_current('a', 0)

        self.combo.set('d')
        check_get_current('d', -1)

        # testing values with empty string
        self.combo.set('')
        self.combo['values'] = (1, 2, '', 3)
        check_get_current('', 2)

        # testing values with empty string set through configure
        self.combo.configure(values=[1, '', 2])
        self.assertEqual(self.combo['values'],
                         ('1', '', '2') if self.wantobjects else
                         '1 {} 2')

        # testing values with spaces
        self.combo['values'] = ['a b', 'a\tb', 'a\nb']
        self.assertEqual(self.combo['values'],
                         ('a b', 'a\tb', 'a\nb') if self.wantobjects else
                         '{a b} {a\tb} {a\nb}')

        # testing values with special characters
        self.combo['values'] = [r'a\tb', '"a"', '} {']
        self.assertEqual(self.combo['values'],
                         (r'a\tb', '"a"', '} {') if self.wantobjects else
                         r'a\\tb {"a"} \}\ \{')

        # out of range
        self.assertRaises(tkinter.TclError, self.combo.current,
            len(self.combo['values']))
        # it expects an integer (or something that can be converted to int)
        self.assertRaises(tkinter.TclError, self.combo.current, '')

        # testing creating combobox with empty string in values
        combo2 = ttk.Combobox(self.root, values=[1, 2, ''])
        self.assertEqual(combo2['values'],
                         ('1', '2', '') if self.wantobjects else '1 2 {}')
        combo2.destroy()


@add_standard_options(IntegerSizeTests, StandardTtkOptionsTests)
class PanedWindowTest(AbstractWidgetTest, unittest.TestCase):
    OPTIONS = (
        'class', 'cursor', 'height',
        'orient', 'style', 'takefocus', 'width',
    )

    def setUp(self):
        super(PanedWindowTest, self).setUp()
        self.paned = self.create()

    def create(self, **kwargs):
        return ttk.PanedWindow(self.root, **kwargs)

    def test_orient(self):
        widget = self.create()
        self.assertEqual(str(widget['orient']), 'vertical')
        errmsg='attempt to change read-only option'
        if get_tk_patchlevel() < (8, 6, 0, 'beta', 3):
            errmsg='Attempt to change read-only option'
        self.checkInvalidParam(widget, 'orient', 'horizontal',
                errmsg=errmsg)
        widget2 = self.create(orient='horizontal')
        self.assertEqual(str(widget2['orient']), 'horizontal')

    def test_add(self):
        # attempt to add a child that is not a direct child of the paned window
        label = ttk.Label(self.paned)
        child = ttk.Label(label)
        self.assertRaises(tkinter.TclError, self.paned.add, child)
        label.destroy()
        child.destroy()
        # another attempt
        label = ttk.Label(self.root)
        child = ttk.Label(label)
        self.assertRaises(tkinter.TclError, self.paned.add, child)
        child.destroy()
        label.destroy()

        good_child = ttk.Label(self.root)
        self.paned.add(good_child)
        # re-adding a child is not accepted
        self.assertRaises(tkinter.TclError, self.paned.add, good_child)

        other_child = ttk.Label(self.paned)
        self.paned.add(other_child)
        self.assertEqual(self.paned.pane(0), self.paned.pane(1))
        self.assertRaises(tkinter.TclError, self.paned.pane, 2)
        good_child.destroy()
        other_child.destroy()
        self.assertRaises(tkinter.TclError, self.paned.pane, 0)


    def test_forget(self):
        self.assertRaises(tkinter.TclError, self.paned.forget, None)
        self.assertRaises(tkinter.TclError, self.paned.forget, 0)

        self.paned.add(ttk.Label(self.root))
        self.paned.forget(0)
        self.assertRaises(tkinter.TclError, self.paned.forget, 0)


    def test_insert(self):
        self.assertRaises(tkinter.TclError, self.paned.insert, None, 0)
        self.assertRaises(tkinter.TclError, self.paned.insert, 0, None)
        self.assertRaises(tkinter.TclError, self.paned.insert, 0, 0)

        child = ttk.Label(self.root)
        child2 = ttk.Label(self.root)
        child3 = ttk.Label(self.root)

        self.assertRaises(tkinter.TclError, self.paned.insert, 0, child)

        self.paned.insert('end', child2)
        self.paned.insert(0, child)
        self.assertEqual(self.paned.panes(), (str(child), str(child2)))

        self.paned.insert(0, child2)
        self.assertEqual(self.paned.panes(), (str(child2), str(child)))

        self.paned.insert('end', child3)
        self.assertEqual(self.paned.panes(),
            (str(child2), str(child), str(child3)))

        # reinserting a child should move it to its current position
        panes = self.paned.panes()
        self.paned.insert('end', child3)
        self.assertEqual(panes, self.paned.panes())

        # moving child3 to child2 position should result in child2 ending up
        # in previous child position and child ending up in previous child3
        # position
        self.paned.insert(child2, child3)
        self.assertEqual(self.paned.panes(),
            (str(child3), str(child2), str(child)))


    def test_pane(self):
        self.assertRaises(tkinter.TclError, self.paned.pane, 0)

        child = ttk.Label(self.root)
        self.paned.add(child)
        self.assertIsInstance(self.paned.pane(0), dict)
        self.assertEqual(self.paned.pane(0, weight=None),
                         0 if self.wantobjects else '0')
        # newer form for querying a single option
        self.assertEqual(self.paned.pane(0, 'weight'),
                         0 if self.wantobjects else '0')
        self.assertEqual(self.paned.pane(0), self.paned.pane(str(child)))

        self.assertRaises(tkinter.TclError, self.paned.pane, 0,
            badoption='somevalue')


    def test_sashpos(self):
        self.assertRaises(tkinter.TclError, self.paned.sashpos, None)
        self.assertRaises(tkinter.TclError, self.paned.sashpos, '')
        self.assertRaises(tkinter.TclError, self.paned.sashpos, 0)

        child = ttk.Label(self.paned, text='a')
        self.paned.add(child, weight=1)
        self.assertRaises(tkinter.TclError, self.paned.sashpos, 0)
        child2 = ttk.Label(self.paned, text='b')
        self.paned.add(child2)
        self.assertRaises(tkinter.TclError, self.paned.sashpos, 1)

        self.paned.pack(expand=True, fill='both')
        self.paned.wait_visibility()

        curr_pos = self.paned.sashpos(0)
        self.paned.sashpos(0, 1000)
        self.assertNotEqual(curr_pos, self.paned.sashpos(0))
        self.assertIsInstance(self.paned.sashpos(0), int)


@add_standard_options(StandardTtkOptionsTests)
class RadiobuttonTest(AbstractLabelTest, unittest.TestCase):
    OPTIONS = (
        'class', 'command', 'compound', 'cursor',
        'image',
        'padding', 'state', 'style',
        'takefocus', 'text', 'textvariable',
        'underline', 'value', 'variable', 'width',
    )

    def create(self, **kwargs):
        return ttk.Radiobutton(self.root, **kwargs)

    def test_value(self):
        widget = self.create()
        self.checkParams(widget, 'value', 1, 2.3, '', 'any string')

    def test_invoke(self):
        success = []
        def cb_test():
            success.append(1)
            return "cb test called"

        myvar = tkinter.IntVar(self.root)
        cbtn = ttk.Radiobutton(self.root, command=cb_test,
                               variable=myvar, value=0)
        cbtn2 = ttk.Radiobutton(self.root, command=cb_test,
                                variable=myvar, value=1)

        if self.wantobjects:
            conv = lambda x: x
        else:
            conv = int

        res = cbtn.invoke()
        self.assertEqual(res, "cb test called")
        self.assertEqual(conv(cbtn['value']), myvar.get())
        self.assertEqual(myvar.get(),
            conv(cbtn.tk.globalgetvar(cbtn['variable'])))
        self.assertTrue(success)

        cbtn2['command'] = ''
        res = cbtn2.invoke()
        self.assertEqual(str(res), '')
        self.assertLessEqual(len(success), 1)
        self.assertEqual(conv(cbtn2['value']), myvar.get())
        self.assertEqual(myvar.get(),
            conv(cbtn.tk.globalgetvar(cbtn['variable'])))

        self.assertEqual(str(cbtn['variable']), str(cbtn2['variable']))


class MenubuttonTest(AbstractLabelTest, unittest.TestCase):
    OPTIONS = (
        'class', 'compound', 'cursor', 'direction',
        'image', 'menu', 'padding', 'state', 'style',
        'takefocus', 'text', 'textvariable',
        'underline', 'width',
    )

    def create(self, **kwargs):
        return ttk.Menubutton(self.root, **kwargs)

    def test_direction(self):
        widget = self.create()
        self.checkEnumParam(widget, 'direction',
                'above', 'below', 'left', 'right', 'flush')

    def test_menu(self):
        widget = self.create()
        menu = tkinter.Menu(widget, name='menu')
        self.checkParam(widget, 'menu', menu, conv=str)
        menu.destroy()


@add_standard_options(StandardTtkOptionsTests)
class ScaleTest(AbstractWidgetTest, unittest.TestCase):
    OPTIONS = (
        'class', 'command', 'cursor', 'from', 'length',
        'orient', 'style', 'takefocus', 'to', 'value', 'variable',
    )
    _conv_pixels = noconv_meth
    default_orient = 'horizontal'

    def setUp(self):
        super(ScaleTest, self).setUp()
        self.scale = self.create()
        self.scale.pack()
        self.scale.update()

    def create(self, **kwargs):
        return ttk.Scale(self.root, **kwargs)

    def test_from(self):
        widget = self.create()
        self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=False)

    def test_length(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'length', 130, 131.2, 135.6, '5i')

    def test_to(self):
        widget = self.create()
        self.checkFloatParam(widget, 'to', 300, 14.9, 15.1, -10, conv=False)

    def test_value(self):
        widget = self.create()
        self.checkFloatParam(widget, 'value', 300, 14.9, 15.1, -10, conv=False)

    def test_custom_event(self):
        failure = [1, 1, 1] # will need to be empty

        funcid = self.scale.bind('<<RangeChanged>>', lambda evt: failure.pop())

        self.scale['from'] = 10
        self.scale['from_'] = 10
        self.scale['to'] = 3

        self.assertFalse(failure)

        failure = [1, 1, 1]
        self.scale.configure(from_=2, to=5)
        self.scale.configure(from_=0, to=-2)
        self.scale.configure(to=10)

        self.assertFalse(failure)


    def test_get(self):
        if self.wantobjects:
            conv = lambda x: x
        else:
            conv = float

        scale_width = self.scale.winfo_width()
        self.assertEqual(self.scale.get(scale_width, 0), self.scale['to'])

        self.assertEqual(conv(self.scale.get(0, 0)), conv(self.scale['from']))
        self.assertEqual(self.scale.get(), self.scale['value'])
        self.scale['value'] = 30
        self.assertEqual(self.scale.get(), self.scale['value'])

        self.assertRaises(tkinter.TclError, self.scale.get, '', 0)
        self.assertRaises(tkinter.TclError, self.scale.get, 0, '')


    def test_set(self):
        if self.wantobjects:
            conv = lambda x: x
        else:
            conv = float

        # set restricts the max/min values according to the current range
        max = conv(self.scale['to'])
        new_max = max + 10
        self.scale.set(new_max)
        self.assertEqual(conv(self.scale.get()), max)
        min = conv(self.scale['from'])
        self.scale.set(min - 1)
        self.assertEqual(conv(self.scale.get()), min)

        # changing directly the variable doesn't impose this limitation tho
        var = tkinter.DoubleVar(self.root)
        self.scale['variable'] = var
        var.set(max + 5)
        self.assertEqual(conv(self.scale.get()), var.get())
        self.assertEqual(conv(self.scale.get()), max + 5)
        del var

        # the same happens with the value option
        self.scale['value'] = max + 10
        self.assertEqual(conv(self.scale.get()), max + 10)
        self.assertEqual(conv(self.scale.get()), conv(self.scale['value']))

        # nevertheless, note that the max/min values we can get specifying
        # x, y coords are the ones according to the current range
        self.assertEqual(conv(self.scale.get(0, 0)), min)
        self.assertEqual(conv(self.scale.get(self.scale.winfo_width(), 0)), max)

        self.assertRaises(tkinter.TclError, self.scale.set, None)


@add_standard_options(StandardTtkOptionsTests)
class ProgressbarTest(AbstractWidgetTest, unittest.TestCase):
    OPTIONS = (
        'class', 'cursor', 'orient', 'length',
        'mode', 'maximum', 'phase',
        'style', 'takefocus', 'value', 'variable',
    )
    _conv_pixels = noconv_meth
    default_orient = 'horizontal'

    def create(self, **kwargs):
        return ttk.Progressbar(self.root, **kwargs)

    def test_length(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'length', 100.1, 56.7, '2i')

    def test_maximum(self):
        widget = self.create()
        self.checkFloatParam(widget, 'maximum', 150.2, 77.7, 0, -10, conv=False)

    def test_mode(self):
        widget = self.create()
        self.checkEnumParam(widget, 'mode', 'determinate', 'indeterminate')

    def test_phase(self):
        # XXX
        pass

    def test_value(self):
        widget = self.create()
        self.checkFloatParam(widget, 'value', 150.2, 77.7, 0, -10,
                             conv=False)


@unittest.skipIf(sys.platform == 'darwin',
                 'ttk.Scrollbar is special on MacOSX')
@add_standard_options(StandardTtkOptionsTests)
class ScrollbarTest(AbstractWidgetTest, unittest.TestCase):
    OPTIONS = (
        'class', 'command', 'cursor', 'orient', 'style', 'takefocus',
    )
    default_orient = 'vertical'

    def create(self, **kwargs):
        return ttk.Scrollbar(self.root, **kwargs)


@add_standard_options(IntegerSizeTests, StandardTtkOptionsTests)
class NotebookTest(AbstractWidgetTest, unittest.TestCase):
    OPTIONS = (
        'class', 'cursor', 'height', 'padding', 'style', 'takefocus', 'width',
    )

    def setUp(self):
        super(NotebookTest, self).setUp()
        self.nb = self.create(padding=0)
        self.child1 = ttk.Label(self.root)
        self.child2 = ttk.Label(self.root)
        self.nb.add(self.child1, text='a')
        self.nb.add(self.child2, text='b')

    def create(self, **kwargs):
        return ttk.Notebook(self.root, **kwargs)

    def test_tab_identifiers(self):
        self.nb.forget(0)
        self.nb.hide(self.child2)
        self.assertRaises(tkinter.TclError, self.nb.tab, self.child1)
        self.assertEqual(self.nb.index('end'), 1)
        self.nb.add(self.child2)
        self.assertEqual(self.nb.index('end'), 1)
        self.nb.select(self.child2)

        self.assertTrue(self.nb.tab('current'))
        self.nb.add(self.child1, text='a')

        self.nb.pack()
        self.nb.wait_visibility()
        if sys.platform == 'darwin':
            tb_idx = "@20,5"
        else:
            tb_idx = "@5,5"
        self.assertEqual(self.nb.tab(tb_idx), self.nb.tab('current'))

        for i in range(5, 100, 5):
            try:
                if self.nb.tab('@%d, 5' % i, text=None) == 'a':
                    break
            except tkinter.TclError:
                pass

        else:
            self.fail("Tab with text 'a' not found")


    def test_add_and_hidden(self):
        self.assertRaises(tkinter.TclError, self.nb.hide, -1)
        self.assertRaises(tkinter.TclError, self.nb.hide, 'hi')
        self.assertRaises(tkinter.TclError, self.nb.hide, None)
        self.assertRaises(tkinter.TclError, self.nb.add, None)
        self.assertRaises(tkinter.TclError, self.nb.add, ttk.Label(self.root),
            unknown='option')

        tabs = self.nb.tabs()
        self.nb.hide(self.child1)
        self.nb.add(self.child1)
        self.assertEqual(self.nb.tabs(), tabs)

        child = ttk.Label(self.root)
        self.nb.add(child, text='c')
        tabs = self.nb.tabs()

        curr = self.nb.index('current')
        # verify that the tab gets readded at its previous position
        child2_index = self.nb.index(self.child2)
        self.nb.hide(self.child2)
        self.nb.add(self.child2)
        self.assertEqual(self.nb.tabs(), tabs)
        self.assertEqual(self.nb.index(self.child2), child2_index)
        self.assertEqual(str(self.child2), self.nb.tabs()[child2_index])
        # but the tab next to it (not hidden) is the one selected now
        self.assertEqual(self.nb.index('current'), curr + 1)


    def test_forget(self):
        self.assertRaises(tkinter.TclError, self.nb.forget, -1)
        self.assertRaises(tkinter.TclError, self.nb.forget, 'hi')
        self.assertRaises(tkinter.TclError, self.nb.forget, None)

        tabs = self.nb.tabs()
        child1_index = self.nb.index(self.child1)
        self.nb.forget(self.child1)
        self.assertNotIn(str(self.child1), self.nb.tabs())
        self.assertEqual(len(tabs) - 1, len(self.nb.tabs()))

        self.nb.add(self.child1)
        self.assertEqual(self.nb.index(self.child1), 1)
        self.assertNotEqual(child1_index, self.nb.index(self.child1))


    def test_index(self):
        self.assertRaises(tkinter.TclError, self.nb.index, -1)
        self.assertRaises(tkinter.TclError, self.nb.index, None)

        self.assertIsInstance(self.nb.index('end'), int)
        self.assertEqual(self.nb.index(self.child1), 0)
        self.assertEqual(self.nb.index(self.child2), 1)
        self.assertEqual(self.nb.index('end'), 2)


    def test_insert(self):
        # moving tabs
        tabs = self.nb.tabs()
        self.nb.insert(1, tabs[0])
        self.assertEqual(self.nb.tabs(), (tabs[1], tabs[0]))
        self.nb.insert(self.child1, self.child2)
        self.assertEqual(self.nb.tabs(), tabs)
        self.nb.insert('end', self.child1)
        self.assertEqual(self.nb.tabs(), (tabs[1], tabs[0]))
        self.nb.insert('end', 0)
        self.assertEqual(self.nb.tabs(), tabs)
        # bad moves
        self.assertRaises(tkinter.TclError, self.nb.insert, 2, tabs[0])
        self.assertRaises(tkinter.TclError, self.nb.insert, -1, tabs[0])

        # new tab
        child3 = ttk.Label(self.root)
        self.nb.insert(1, child3)
        self.assertEqual(self.nb.tabs(), (tabs[0], str(child3), tabs[1]))
        self.nb.forget(child3)
        self.assertEqual(self.nb.tabs(), tabs)
        self.nb.insert(self.child1, child3)
        self.assertEqual(self.nb.tabs(), (str(child3), ) + tabs)
        self.nb.forget(child3)
        self.assertRaises(tkinter.TclError, self.nb.insert, 2, child3)
        self.assertRaises(tkinter.TclError, self.nb.insert, -1, child3)

        # bad inserts
        self.assertRaises(tkinter.TclError, self.nb.insert, 'end', None)
        self.assertRaises(tkinter.TclError, self.nb.insert, None, 0)
        self.assertRaises(tkinter.TclError, self.nb.insert, None, None)


    def test_select(self):
        self.nb.pack()
        self.nb.wait_visibility()

        success = []
        tab_changed = []

        self.child1.bind('<Unmap>', lambda evt: success.append(True))
        self.nb.bind('<<NotebookTabChanged>>',
            lambda evt: tab_changed.append(True))

        self.assertEqual(self.nb.select(), str(self.child1))
        self.nb.select(self.child2)
        self.assertTrue(success)
        self.assertEqual(self.nb.select(), str(self.child2))

        self.nb.update()
        self.assertTrue(tab_changed)


    def test_tab(self):
        self.assertRaises(tkinter.TclError, self.nb.tab, -1)
        self.assertRaises(tkinter.TclError, self.nb.tab, 'notab')
        self.assertRaises(tkinter.TclError, self.nb.tab, None)

        self.assertIsInstance(self.nb.tab(self.child1), dict)
        self.assertEqual(self.nb.tab(self.child1, text=None), 'a')
        # newer form for querying a single option
        self.assertEqual(self.nb.tab(self.child1, 'text'), 'a')
        self.nb.tab(self.child1, text='abc')
        self.assertEqual(self.nb.tab(self.child1, text=None), 'abc')
        self.assertEqual(self.nb.tab(self.child1, 'text'), 'abc')


    def test_tabs(self):
        self.assertEqual(len(self.nb.tabs()), 2)

        self.nb.forget(self.child1)
        self.nb.forget(self.child2)

        self.assertEqual(self.nb.tabs(), ())


    def test_traversal(self):
        self.nb.pack()
        self.nb.wait_visibility()

        self.nb.select(0)

        simulate_mouse_click(self.nb, 5, 5)
        self.nb.focus_force()
        self.nb.event_generate('<Control-Tab>')
        self.assertEqual(self.nb.select(), str(self.child2))
        self.nb.focus_force()
        self.nb.event_generate('<Shift-Control-Tab>')
        self.assertEqual(self.nb.select(), str(self.child1))
        self.nb.focus_force()
        self.nb.event_generate('<Shift-Control-Tab>')
        self.assertEqual(self.nb.select(), str(self.child2))

        self.nb.tab(self.child1, text='a', underline=0)
        self.nb.enable_traversal()
        self.nb.focus_force()
        simulate_mouse_click(self.nb, 5, 5)
        if sys.platform == 'darwin':
            self.nb.event_generate('<Option-a>')
        else:
            self.nb.event_generate('<Alt-a>')
        self.assertEqual(self.nb.select(), str(self.child1))


@add_standard_options(StandardTtkOptionsTests)
class TreeviewTest(AbstractWidgetTest, unittest.TestCase):
    OPTIONS = (
        'class', 'columns', 'cursor', 'displaycolumns',
        'height', 'padding', 'selectmode', 'show',
        'style', 'takefocus', 'xscrollcommand', 'yscrollcommand',
    )

    def setUp(self):
        super(TreeviewTest, self).setUp()
        self.tv = self.create(padding=0)

    def create(self, **kwargs):
        return ttk.Treeview(self.root, **kwargs)

    def test_columns(self):
        widget = self.create()
        self.checkParam(widget, 'columns', 'a b c',
                        expected=('a', 'b', 'c'))
        self.checkParam(widget, 'columns', ('a', 'b', 'c'))
        self.checkParam(widget, 'columns', () if tcl_version < (8, 5) else '')

    def test_displaycolumns(self):
        widget = self.create()
        widget['columns'] = ('a', 'b', 'c')
        self.checkParam(widget, 'displaycolumns', 'b a c',
                        expected=('b', 'a', 'c'))
        self.checkParam(widget, 'displaycolumns', ('b', 'a', 'c'))
        self.checkParam(widget, 'displaycolumns', '#all',
                        expected=('#all',))
        self.checkParam(widget, 'displaycolumns', (2, 1, 0))
        self.checkInvalidParam(widget, 'displaycolumns', ('a', 'b', 'd'),
                               errmsg='Invalid column index d')
        self.checkInvalidParam(widget, 'displaycolumns', (1, 2, 3),
                               errmsg='Column index 3 out of bounds')
        self.checkInvalidParam(widget, 'displaycolumns', (1, -2),
                               errmsg='Column index -2 out of bounds')

    def test_height(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'height', 100, -100, 0, '3c', conv=False)
        self.checkPixelsParam(widget, 'height', 101.2, 102.6, conv=noconv)

    def test_selectmode(self):
        widget = self.create()
        self.checkEnumParam(widget, 'selectmode',
                            'none', 'browse', 'extended')

    def test_show(self):
        widget = self.create()
        self.checkParam(widget, 'show', 'tree headings',
                        expected=('tree', 'headings'))
        self.checkParam(widget, 'show', ('tree', 'headings'))
        self.checkParam(widget, 'show', ('headings', 'tree'))
        self.checkParam(widget, 'show', 'tree', expected=('tree',))
        self.checkParam(widget, 'show', 'headings', expected=('headings',))

    def test_bbox(self):
        self.tv.pack()
        self.assertEqual(self.tv.bbox(''), '')
        self.tv.wait_visibility()
        self.tv.update()

        item_id = self.tv.insert('', 'end')
        children = self.tv.get_children()
        self.assertTrue(children)

        bbox = self.tv.bbox(children[0])
        self.assertIsBoundingBox(bbox)

        # compare width in bboxes
        self.tv['columns'] = ['test']
        self.tv.column('test', width=50)
        bbox_column0 = self.tv.bbox(children[0], 0)
        root_width = self.tv.column('#0', width=None)
        if not self.wantobjects:
            root_width = int(root_width)
        self.assertEqual(bbox_column0[0], bbox[0] + root_width)

        # verify that bbox of a closed item is the empty string
        child1 = self.tv.insert(item_id, 'end')
        self.assertEqual(self.tv.bbox(child1), '')


    def test_children(self):
        # no children yet, should get an empty tuple
        self.assertEqual(self.tv.get_children(), ())

        item_id = self.tv.insert('', 'end')
        self.assertIsInstance(self.tv.get_children(), tuple)
        self.assertEqual(self.tv.get_children()[0], item_id)

        # add item_id and child3 as children of child2
        child2 = self.tv.insert('', 'end')
        child3 = self.tv.insert('', 'end')
        self.tv.set_children(child2, item_id, child3)
        self.assertEqual(self.tv.get_children(child2), (item_id, child3))

        # child3 has child2 as parent, thus trying to set child2 as a children
        # of child3 should result in an error
        self.assertRaises(tkinter.TclError,
            self.tv.set_children, child3, child2)

        # remove child2 children
        self.tv.set_children(child2)
        self.assertEqual(self.tv.get_children(child2), ())

        # remove root's children
        self.tv.set_children('')
        self.assertEqual(self.tv.get_children(), ())


    def test_column(self):
        # return a dict with all options/values
        self.assertIsInstance(self.tv.column('#0'), dict)
        # return a single value of the given option
        if self.wantobjects:
            self.assertIsInstance(self.tv.column('#0', width=None), int)
        # set a new value for an option
        self.tv.column('#0', width=10)
        # testing new way to get option value
        self.assertEqual(self.tv.column('#0', 'width'),
                         10 if self.wantobjects else '10')
        self.assertEqual(self.tv.column('#0', width=None),
                         10 if self.wantobjects else '10')
        # check read-only option
        self.assertRaises(tkinter.TclError, self.tv.column, '#0', id='X')

        self.assertRaises(tkinter.TclError, self.tv.column, 'invalid')
        invalid_kws = [
            {'unknown_option': 'some value'},  {'stretch': 'wrong'},
            {'anchor': 'wrong'}, {'width': 'wrong'}, {'minwidth': 'wrong'}
        ]
        for kw in invalid_kws:
            self.assertRaises(tkinter.TclError, self.tv.column, '#0',
                **kw)


    def test_delete(self):
        self.assertRaises(tkinter.TclError, self.tv.delete, '#0')

        item_id = self.tv.insert('', 'end')
        item2 = self.tv.insert(item_id, 'end')
        self.assertEqual(self.tv.get_children(), (item_id, ))
        self.assertEqual(self.tv.get_children(item_id), (item2, ))

        self.tv.delete(item_id)
        self.assertFalse(self.tv.get_children())

        # reattach should fail
        self.assertRaises(tkinter.TclError,
            self.tv.reattach, item_id, '', 'end')

        # test multiple item delete
        item1 = self.tv.insert('', 'end')
        item2 = self.tv.insert('', 'end')
        self.assertEqual(self.tv.get_children(), (item1, item2))

        self.tv.delete(item1, item2)
        self.assertFalse(self.tv.get_children())


    def test_detach_reattach(self):
        item_id = self.tv.insert('', 'end')
        item2 = self.tv.insert(item_id, 'end')

        # calling detach without items is valid, although it does nothing
        prev = self.tv.get_children()
        self.tv.detach() # this should do nothing
        self.assertEqual(prev, self.tv.get_children())

        self.assertEqual(self.tv.get_children(), (item_id, ))
        self.assertEqual(self.tv.get_children(item_id), (item2, ))

        # detach item with children
        self.tv.detach(item_id)
        self.assertFalse(self.tv.get_children())

        # reattach item with children
        self.tv.reattach(item_id, '', 'end')
        self.assertEqual(self.tv.get_children(), (item_id, ))
        self.assertEqual(self.tv.get_children(item_id), (item2, ))

        # move a children to the root
        self.tv.move(item2, '', 'end')
        self.assertEqual(self.tv.get_children(), (item_id, item2))
        self.assertEqual(self.tv.get_children(item_id), ())

        # bad values
        self.assertRaises(tkinter.TclError,
            self.tv.reattach, 'nonexistent', '', 'end')
        self.assertRaises(tkinter.TclError,
            self.tv.detach, 'nonexistent')
        self.assertRaises(tkinter.TclError,
            self.tv.reattach, item2, 'otherparent', 'end')
        self.assertRaises(tkinter.TclError,
            self.tv.reattach, item2, '', 'invalid')

        # multiple detach
        self.tv.detach(item_id, item2)
        self.assertEqual(self.tv.get_children(), ())
        self.assertEqual(self.tv.get_children(item_id), ())


    def test_exists(self):
        self.assertEqual(self.tv.exists('something'), False)
        self.assertEqual(self.tv.exists(''), True)
        self.assertEqual(self.tv.exists({}), False)

        # the following will make a tk.call equivalent to
        # tk.call(treeview, "exists") which should result in an error
        # in the tcl interpreter since tk requires an item.
        self.assertRaises(tkinter.TclError, self.tv.exists, None)


    def test_focus(self):
        # nothing is focused right now
        self.assertEqual(self.tv.focus(), '')

        item1 = self.tv.insert('', 'end')
        self.tv.focus(item1)
        self.assertEqual(self.tv.focus(), item1)

        self.tv.delete(item1)
        self.assertEqual(self.tv.focus(), '')

        # try focusing inexistent item
        self.assertRaises(tkinter.TclError, self.tv.focus, 'hi')


    def test_heading(self):
        # check a dict is returned
        self.assertIsInstance(self.tv.heading('#0'), dict)

        # check a value is returned
        self.tv.heading('#0', text='hi')
        self.assertEqual(self.tv.heading('#0', 'text'), 'hi')
        self.assertEqual(self.tv.heading('#0', text=None), 'hi')

        # invalid option
        self.assertRaises(tkinter.TclError, self.tv.heading, '#0',
            background=None)
        # invalid value
        self.assertRaises(tkinter.TclError, self.tv.heading, '#0',
            anchor=1)

    def test_heading_callback(self):
        def simulate_heading_click(x, y):
            simulate_mouse_click(self.tv, x, y)
            self.tv.update()

        success = [] # no success for now

        self.tv.pack()
        self.tv.wait_visibility()
        self.tv.heading('#0', command=lambda: success.append(True))
        self.tv.column('#0', width=100)
        self.tv.update()

        # assuming that the coords (5, 5) fall into heading #0
        simulate_heading_click(5, 5)
        if not success:
            self.fail("The command associated to the treeview heading wasn't "
                "invoked.")

        success = []
        commands = self.tv.master._tclCommands
        self.tv.heading('#0', command=str(self.tv.heading('#0', command=None)))
        self.assertEqual(commands, self.tv.master._tclCommands)
        simulate_heading_click(5, 5)
        if not success:
            self.fail("The command associated to the treeview heading wasn't "
                "invoked.")

        # XXX The following raises an error in a tcl interpreter, but not in
        # Python
        #self.tv.heading('#0', command='I dont exist')
        #simulate_heading_click(5, 5)


    def test_index(self):
        # item 'what' doesn't exist
        self.assertRaises(tkinter.TclError, self.tv.index, 'what')

        self.assertEqual(self.tv.index(''), 0)

        item1 = self.tv.insert('', 'end')
        item2 = self.tv.insert('', 'end')
        c1 = self.tv.insert(item1, 'end')
        c2 = self.tv.insert(item1, 'end')
        self.assertEqual(self.tv.index(item1), 0)
        self.assertEqual(self.tv.index(c1), 0)
        self.assertEqual(self.tv.index(c2), 1)
        self.assertEqual(self.tv.index(item2), 1)

        self.tv.move(item2, '', 0)
        self.assertEqual(self.tv.index(item2), 0)
        self.assertEqual(self.tv.index(item1), 1)

        # check that index still works even after its parent and siblings
        # have been detached
        self.tv.detach(item1)
        self.assertEqual(self.tv.index(c2), 1)
        self.tv.detach(c1)
        self.assertEqual(self.tv.index(c2), 0)

        # but it fails after item has been deleted
        self.tv.delete(item1)
        self.assertRaises(tkinter.TclError, self.tv.index, c2)


    def test_insert_item(self):
        # parent 'none' doesn't exist
        self.assertRaises(tkinter.TclError, self.tv.insert, 'none', 'end')

        # open values
        self.assertRaises(tkinter.TclError, self.tv.insert, '', 'end',
            open='')
        self.assertRaises(tkinter.TclError, self.tv.insert, '', 'end',
            open='please')
        self.assertFalse(self.tv.delete(self.tv.insert('', 'end', open=True)))
        self.assertFalse(self.tv.delete(self.tv.insert('', 'end', open=False)))

        # invalid index
        self.assertRaises(tkinter.TclError, self.tv.insert, '', 'middle')

        # trying to duplicate item id is invalid
        itemid = self.tv.insert('', 'end', 'first-item')
        self.assertEqual(itemid, 'first-item')
        self.assertRaises(tkinter.TclError, self.tv.insert, '', 'end',
            'first-item')
        self.assertRaises(tkinter.TclError, self.tv.insert, '', 'end',
            MockTclObj('first-item'))

        # unicode values
        value = u'\xe1ba'
        item = self.tv.insert('', 'end', values=(value, ))
        self.assertEqual(self.tv.item(item, 'values'),
                         (value,) if self.wantobjects else value)
        self.assertEqual(self.tv.item(item, values=None),
                         (value,) if self.wantobjects else value)

        self.tv.item(item, values=self.root.splitlist(self.tv.item(item, values=None)))
        self.assertEqual(self.tv.item(item, values=None),
                         (value,) if self.wantobjects else value)

        self.assertIsInstance(self.tv.item(item), dict)

        # erase item values
        self.tv.item(item, values='')
        self.assertFalse(self.tv.item(item, values=None))

        # item tags
        item = self.tv.insert('', 'end', tags=[1, 2, value])
        self.assertEqual(self.tv.item(item, tags=None),
                         ('1', '2', value) if self.wantobjects else
                         '1 2 %s' % value)
        self.tv.item(item, tags=[])
        self.assertFalse(self.tv.item(item, tags=None))
        self.tv.item(item, tags=(1, 2))
        self.assertEqual(self.tv.item(item, tags=None),
                         ('1', '2') if self.wantobjects else '1 2')

        # values with spaces
        item = self.tv.insert('', 'end', values=('a b c',
            '%s %s' % (value, value)))
        self.assertEqual(self.tv.item(item, values=None),
            ('a b c', '%s %s' % (value, value)) if self.wantobjects else
            '{a b c} {%s %s}' % (value, value))

        # text
        self.assertEqual(self.tv.item(
            self.tv.insert('', 'end', text="Label here"), text=None),
            "Label here")
        self.assertEqual(self.tv.item(
            self.tv.insert('', 'end', text=value), text=None),
            value)

        # test for values which are not None
        itemid = self.tv.insert('', 'end', 0)
        self.assertEqual(itemid, '0')
        itemid = self.tv.insert('', 'end', 0.0)
        self.assertEqual(itemid, '0.0')
        # this is because False resolves to 0 and element with 0 iid is already present
        self.assertRaises(tkinter.TclError, self.tv.insert, '', 'end', False)
        self.assertRaises(tkinter.TclError, self.tv.insert, '', 'end', '')


    def test_selection(self):
        # item 'none' doesn't exist
        self.assertRaises(tkinter.TclError, self.tv.selection_set, 'none')
        self.assertRaises(tkinter.TclError, self.tv.selection_add, 'none')
        self.assertRaises(tkinter.TclError, self.tv.selection_remove, 'none')
        self.assertRaises(tkinter.TclError, self.tv.selection_toggle, 'none')

        item1 = self.tv.insert('', 'end')
        item2 = self.tv.insert('', 'end')
        c1 = self.tv.insert(item1, 'end')
        c2 = self.tv.insert(item1, 'end')
        c3 = self.tv.insert(item1, 'end')
        self.assertEqual(self.tv.selection(), ())

        self.tv.selection_set((c1, item2))
        self.assertEqual(self.tv.selection(), (c1, item2))
        self.tv.selection_set(c2)
        self.assertEqual(self.tv.selection(), (c2,))

        self.tv.selection_add((c1, item2))
        self.assertEqual(self.tv.selection(), (c1, c2, item2))
        self.tv.selection_add(item1)
        self.assertEqual(self.tv.selection(), (item1, c1, c2, item2))

        self.tv.selection_remove((item1, c3))
        self.assertEqual(self.tv.selection(), (c1, c2, item2))
        self.tv.selection_remove(c2)
        self.assertEqual(self.tv.selection(), (c1, item2))

        self.tv.selection_toggle((c1, c3))
        self.assertEqual(self.tv.selection(), (c3, item2))
        self.tv.selection_toggle(item2)
        self.assertEqual(self.tv.selection(), (c3,))

        self.tv.insert('', 'end', id='with spaces')
        self.tv.selection_set('with spaces')
        self.assertEqual(self.tv.selection(), ('with spaces',))

        self.tv.insert('', 'end', id='{brace')
        self.tv.selection_set('{brace')
        self.assertEqual(self.tv.selection(), ('{brace',))

        if have_unicode:
            self.tv.insert('', 'end', id=u(r'unicode\u20ac'))
            self.tv.selection_set(u(r'unicode\u20ac'))
            self.assertEqual(self.tv.selection(), (u(r'unicode\u20ac'),))

        self.tv.insert('', 'end', id='bytes\xe2\x82\xac')
        self.tv.selection_set('bytes\xe2\x82\xac')
        self.assertEqual(self.tv.selection(),
                         (u(r'bytes\u20ac') if have_unicode else
                          'bytes\xe2\x82\xac',))


    def test_set(self):
        self.tv['columns'] = ['A', 'B']
        item = self.tv.insert('', 'end', values=['a', 'b'])
        self.assertEqual(self.tv.set(item), {'A': 'a', 'B': 'b'})

        self.tv.set(item, 'B', 'a')
        self.assertEqual(self.tv.item(item, values=None),
                         ('a', 'a') if self.wantobjects else 'a a')

        self.tv['columns'] = ['B']
        self.assertEqual(self.tv.set(item), {'B': 'a'})

        self.tv.set(item, 'B', 'b')
        self.assertEqual(self.tv.set(item, column='B'), 'b')
        self.assertEqual(self.tv.item(item, values=None),
                         ('b', 'a') if self.wantobjects else 'b a')

        self.tv.set(item, 'B', 123)
        self.assertEqual(self.tv.set(item, 'B'),
                         123 if self.wantobjects else '123')
        self.assertEqual(self.tv.item(item, values=None),
                         (123, 'a') if self.wantobjects else '123 a')
        self.assertEqual(self.tv.set(item),
                         {'B': 123} if self.wantobjects else {'B': '123'})

        # inexistent column
        self.assertRaises(tkinter.TclError, self.tv.set, item, 'A')
        self.assertRaises(tkinter.TclError, self.tv.set, item, 'A', 'b')

        # inexistent item
        self.assertRaises(tkinter.TclError, self.tv.set, 'notme')


    def test_tag_bind(self):
        events = []
        item1 = self.tv.insert('', 'end', tags=['call'])
        item2 = self.tv.insert('', 'end', tags=['call'])
        self.tv.tag_bind('call', '<ButtonPress-1>',
            lambda evt: events.append(1))
        self.tv.tag_bind('call', '<ButtonRelease-1>',
            lambda evt: events.append(2))

        self.tv.pack()
        self.tv.wait_visibility()
        self.tv.update()

        pos_y = set()
        found = set()
        for i in range(0, 100, 10):
            if len(found) == 2: # item1 and item2 already found
                break
            item_id = self.tv.identify_row(i)
            if item_id and item_id not in found:
                pos_y.add(i)
                found.add(item_id)

        self.assertEqual(len(pos_y), 2) # item1 and item2 y pos
        for y in pos_y:
            simulate_mouse_click(self.tv, 0, y)

        # by now there should be 4 things in the events list, since each
        # item had a bind for two events that were simulated above
        self.assertEqual(len(events), 4)
        for evt in zip(events[::2], events[1::2]):
            self.assertEqual(evt, (1, 2))


    def test_tag_configure(self):
        # Just testing parameter passing for now
        self.assertRaises(TypeError, self.tv.tag_configure)
        self.assertRaises(tkinter.TclError, self.tv.tag_configure,
            'test', sky='blue')
        self.tv.tag_configure('test', foreground='blue')
        self.assertEqual(str(self.tv.tag_configure('test', 'foreground')),
            'blue')
        self.assertEqual(str(self.tv.tag_configure('test', foreground=None)),
            'blue')
        self.assertIsInstance(self.tv.tag_configure('test'), dict)

    def test_tag_has(self):
        item1 = self.tv.insert('', 'end', text='Item 1', tags=['tag1'])
        item2 = self.tv.insert('', 'end', text='Item 2', tags=['tag2'])
        self.assertRaises(TypeError, self.tv.tag_has)
        self.assertRaises(TclError, self.tv.tag_has, 'tag1', 'non-existing')
        self.assertTrue(self.tv.tag_has('tag1', item1))
        self.assertFalse(self.tv.tag_has('tag1', item2))
        self.assertFalse(self.tv.tag_has('tag2', item1))
        self.assertTrue(self.tv.tag_has('tag2', item2))
        self.assertFalse(self.tv.tag_has('tag3', item1))
        self.assertFalse(self.tv.tag_has('tag3', item2))
        self.assertEqual(self.tv.tag_has('tag1'), (item1,))
        self.assertEqual(self.tv.tag_has('tag2'), (item2,))
        self.assertEqual(self.tv.tag_has('tag3'), ())


@add_standard_options(StandardTtkOptionsTests)
class SeparatorTest(AbstractWidgetTest, unittest.TestCase):
    OPTIONS = (
        'class', 'cursor', 'orient', 'style', 'takefocus',
        # 'state'?
    )
    default_orient = 'horizontal'

    def create(self, **kwargs):
        return ttk.Separator(self.root, **kwargs)


@add_standard_options(StandardTtkOptionsTests)
class SizegripTest(AbstractWidgetTest, unittest.TestCase):
    OPTIONS = (
        'class', 'cursor', 'style', 'takefocus',
        # 'state'?
    )

    def create(self, **kwargs):
        return ttk.Sizegrip(self.root, **kwargs)


tests_gui = (
        ButtonTest, CheckbuttonTest, ComboboxTest, EntryTest,
        FrameTest, LabelFrameTest, LabelTest, MenubuttonTest,
        NotebookTest, PanedWindowTest, ProgressbarTest,
        RadiobuttonTest, ScaleTest, ScrollbarTest, SeparatorTest,
        SizegripTest, TreeviewTest, WidgetTest,
        )

if __name__ == "__main__":
    run_unittest(*tests_gui)
test_ttk/__init__.py000064400000000000150351526570010515 0ustar00test_ttk/test_extensions.pyc000064400000023675150351526570012406 0ustar00�
zfc@s�ddlZddlZddlZddlZddlmZmZmZddl	m
Z
mZed�de
ejfd��YZ
de
ejfd��YZe
efZed	kr�ee�ndS(
i����N(trequirestrun_unittestt	swap_attr(tAbstractTkTesttdestroy_default_roottguitLabeledScaleTestcBsGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs$|jj�tt|�j�dS(N(troottupdate_idletaskstsuperRttearDown(tself((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyR
s
cCsltj|j�}|jj}|j�|jtj|j	j
|�tj|j�}|j}tj|jd|�}|j�|jr�|j
|j	j
|�|j��n(|j
t|j	j
|��|j��~|jtj|j	j
|�tj|j�}tj|jd|�}|j�tj|jd|�ttd�rh|jtjtj�ndS(Ntvariablet	last_type(tttktLabeledScaleRt	_variablet_nametdestroytassertRaisesttkintertTclErrorttktglobalgetvart	DoubleVartwantobjectstassertEqualtgettfloattIntVarthasattrtsystassertNotEqualR
(Rtxtvartmyvartname((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_widget_destroys&
	
	%(
cCs�ttdd���ttdt��izYtj�}|jtj�|j|j	tj�|j|j
tjj
�|j�Wdt�XWdQXWdQXdS(Nt
_default_roott_support_default_root(
RRtNonetTrueRRtassertIsNotNoneR&RtmasterRRR(RR!((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_initialization_no_master2scs�tj�j�}tj|�}�j|j|�|j�ddddtj	dtj	dff}�j
r}|d7}nxK|D]C}tj�jd|d�}�j|j|d�|j�q�Wtj�jdd	�}�jt
|jj�|j�tj�jdd�}�jt
|jj�|j�tj�jd
d�}tj�jd|�}�j|jd�|j�tj�jd|dd
�}�j|jd
��j|jj|j�|j��fd�}tj�jdd�}||jd|jd�|j�tj�jdd�}||jd|jd�|j�tj�jdd�}||jd|jd�|j�tj�j�}||jd|jd�|j��jtjtj|dd�dS(Nt0ii
i����ig@itfrom_s2.5tvalueiRg�?cs8�j|j�d|��j|j�d|�dS(Ntsidetanchor(Rt	pack_infot
place_info(tscalet	scale_postlabelt	label_pos(R(s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pytcheck_positionsastcompoundttoptbottomtntstunknowntatb(R-i(ii(i
i
(i����i����(g@i((g@i(RtFrameRRRRR+RRtmaxintRR/Rt
ValueErrorRRR(RRR4R6R(RR+R!tpassed_expectedtpairR#R8((Rs</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_initialization?sP
	 	









cCs^tj|jdddd�}|j�|j�|j�|jj�}|jj	�d}|j
|t|d��|jjdddd�|j�|jj	�d}|j
||�|jj�}|j
|jd|jr�dnd	�|j
|t|d��|jjdddd�|j
||�|j
|t|d��|j�dS(
NR.ittoi
R!i����ittextR-(RRRtpacktwait_visibilitytupdateR6R3R4tcoordsRtintt	configureR RR(Rtlscaletlinfo_1tprev_xcoordtcurr_xcoordtlinfo_2((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_horizontal_rangevs$



&cCsvtj|j�}|j�|j�|j�|jj�d}|jd}||_|j�|j	|j
d|jr�|n	t|��|j
|jj�d|�|j	|jj�dt|j
j�d��|jr�d�}nt}||jd�d|_|j�|j	||j
d�|�|j	|jj�dt|j
j�d��|j�dS(NiiRHR!cSs|S(N((R!((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyt<lambda>�tRG(RRRRIRJRKR4RLR/RR6Rtstrt
assertGreaterRMR3R(RR!RRtnewvaltconv((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_variable_change�s,



	
	
cCs�tj|j�}|jdtdd�|j�|j�|jj�|jj	�}}|d|d}}d|_
|j�|jjd||f�|jt
|jj�d�|jj�d�|jjd||f�|j�dS(	Ntexpandtfilltbothiis%dx%dR!i(RRRRIR)RJRKR+twinfo_widthtwinfo_heightR/twm_geometryRRMR6R3R4RLR(RR!twidththeightt	width_newt
height_new((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_resize�s

	
(	t__name__t
__module__R
R%R,RFRTR[Rf(((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyR
s		"	
	7		 tOptionMenuTestcBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs,tt|�j�tj|j�|_dS(N(R	RitsetUpRt	StringVarRttextvar(R((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyRj�scCs|`tt|�j�dS(N(RlR	RiR
(R((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyR
�scCs�tj|j�}tj|j|�}|j}|j�|j�|j|j	j
|�|j��~|jtj
|j	j
|�dS(N(RRkRRt
OptionMenuRRRRRRRRR(RR"toptmenuR$((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyR%�s	

"cCs�|jtjtj|j|jdd�tj|j|jddd�}|j|jj	�d�|j
|d�|j
|d�|j�dS(NtinvalidtthingR@R?tmenuttextvariable(RRRRRmRRlRRRt
assertTrueR(RRn((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyRF�s!c	s7d
�d}tj�j�j|��}t}xYtt���D]E}|dj|d�}�j|�|�||krCt	}qCqCW�j
|�|j�d}tj�j�j|��}d}d}xQt	r&||dj
|d�}}||kr	Pn�j||�|d7}q�W�j|t���|j�|j�|djd��j|jj��d��jtj|djd	��j|jj��d�|j�g����fd
�}tj�j�jdd|��}|djd��s)�jd�n|j�dS(NR?R@tcRqR/tdiii����cs%�j|�d��jt�dS(Ni(RtappendR)(titem(titemsRtsuccess(s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pytcb_teststcommandsMenu callback not invoked(R?R@Rt(RRmRRltFalsetrangetlent	entrycgetRR)RsRR(tentryconfigureR RIRJtinvokeRRRRRtfail(	RtdefaultRnt
found_defaulttiR/tcurrtlastRz((RxRRys</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyt	test_menu�sJ


	


	cCs;d	}d}tj|j|j||�}tj|j�}tj|j|||�}|j�|j�|j�|j�|djd�|djd�|dj	dd�}|dj	dd�}|j
||�|j|jjj
|�|d�|j|jjj
|�|d�|j�|j�dS(
NR?R@RtRqiiiR(R?R@Rt(RRmRRlRRkRIRJR�RR RRRR(RRxR�Rnttextvar2toptmenu2toptmenu_stringvar_nametoptmenu2_stringvar_name((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_unique_radiobuttonss*



	
(RgRhRjR
R%RFR�R�(((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyRi�s				
	4t__main__(RtunittesttTkinterRRttest.test_supportRRRttest_ttk.supportRRtTestCaseRRit	tests_guiRg(((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyt<module>s
�qtest_ttk/__init__.pyo000064400000000214150351526570010703 0ustar00�
zfc@sdS(N((((s5/usr/lib64/python2.7/lib-tk/test/test_ttk/__init__.pyt<module>ttest_ttk/test_functions.py000064400000041677150351526570012056 0ustar00# -*- encoding: utf-8 -*-
import sys
import unittest
import ttk

class MockTkApp:

    def splitlist(self, arg):
        if isinstance(arg, tuple):
            return arg
        return arg.split(':')

    def wantobjects(self):
        return True


class MockTclObj(object):
    typename = 'test'

    def __init__(self, val):
        self.val = val

    def __str__(self):
        return unicode(self.val)


class MockStateSpec(object):
    typename = 'StateSpec'

    def __init__(self, *args):
        self.val = args

    def __str__(self):
        return ' '.join(self.val)


class InternalFunctionsTest(unittest.TestCase):

    def test_format_optdict(self):
        def check_against(fmt_opts, result):
            for i in range(0, len(fmt_opts), 2):
                self.assertEqual(result.pop(fmt_opts[i]), fmt_opts[i + 1])
            if result:
                self.fail("result still got elements: %s" % result)

        # passing an empty dict should return an empty object (tuple here)
        self.assertFalse(ttk._format_optdict({}))

        # check list formatting
        check_against(
            ttk._format_optdict({'fg': 'blue', 'padding': [1, 2, 3, 4]}),
            {'-fg': 'blue', '-padding': '1 2 3 4'})

        # check tuple formatting (same as list)
        check_against(
            ttk._format_optdict({'test': (1, 2, '', 0)}),
            {'-test': '1 2 {} 0'})

        # check untouched values
        check_against(
            ttk._format_optdict({'test': {'left': 'as is'}}),
            {'-test': {'left': 'as is'}})

        # check script formatting
        check_against(
            ttk._format_optdict(
                {'test': [1, -1, '', '2m', 0], 'test2': 3,
                 'test3': '', 'test4': 'abc def',
                 'test5': '"abc"', 'test6': '{}',
                 'test7': '} -spam {'}, script=True),
            {'-test': '{1 -1 {} 2m 0}', '-test2': '3',
             '-test3': '{}', '-test4': '{abc def}',
             '-test5': '{"abc"}', '-test6': r'\{\}',
             '-test7': r'\}\ -spam\ \{'})

        opts = {u'αβγ': True, u'á': False}
        orig_opts = opts.copy()
        # check if giving unicode keys is fine
        check_against(ttk._format_optdict(opts), {u'-αβγ': True, u'-á': False})
        # opts should remain unchanged
        self.assertEqual(opts, orig_opts)

        # passing values with spaces inside a tuple/list
        check_against(
            ttk._format_optdict(
                {'option': ('one two', 'three')}),
            {'-option': '{one two} three'})
        check_against(
            ttk._format_optdict(
                {'option': ('one\ttwo', 'three')}),
            {'-option': '{one\ttwo} three'})

        # passing empty strings inside a tuple/list
        check_against(
            ttk._format_optdict(
                {'option': ('', 'one')}),
            {'-option': '{} one'})

        # passing values with braces inside a tuple/list
        check_against(
            ttk._format_optdict(
                {'option': ('one} {two', 'three')}),
            {'-option': r'one\}\ \{two three'})

        # passing quoted strings inside a tuple/list
        check_against(
            ttk._format_optdict(
                {'option': ('"one"', 'two')}),
            {'-option': '{"one"} two'})
        check_against(
            ttk._format_optdict(
                {'option': ('{one}', 'two')}),
            {'-option': r'\{one\} two'})

        # ignore an option
        amount_opts = len(ttk._format_optdict(opts, ignore=(u'á'))) // 2
        self.assertEqual(amount_opts, len(opts) - 1)

        # ignore non-existing options
        amount_opts = len(ttk._format_optdict(opts, ignore=(u'á', 'b'))) // 2
        self.assertEqual(amount_opts, len(opts) - 1)

        # ignore every option
        self.assertFalse(ttk._format_optdict(opts, ignore=opts.keys()))


    def test_format_mapdict(self):
        opts = {'a': [('b', 'c', 'val'), ('d', 'otherval'), ('', 'single')]}
        result = ttk._format_mapdict(opts)
        self.assertEqual(len(result), len(opts.keys()) * 2)
        self.assertEqual(result, ('-a', '{b c} val d otherval {} single'))
        self.assertEqual(ttk._format_mapdict(opts, script=True),
            ('-a', '{{b c} val d otherval {} single}'))

        self.assertEqual(ttk._format_mapdict({2: []}), ('-2', ''))

        opts = {u'üñíćódè': [(u'á', u'vãl')]}
        result = ttk._format_mapdict(opts)
        self.assertEqual(result, (u'-üñíćódè', u'á vãl'))

        # empty states
        valid = {'opt': [('', u'', 'hi')]}
        self.assertEqual(ttk._format_mapdict(valid), ('-opt', '{ } hi'))

        # when passing multiple states, they all must be strings
        invalid = {'opt': [(1, 2, 'valid val')]}
        self.assertRaises(TypeError, ttk._format_mapdict, invalid)
        invalid = {'opt': [([1], '2', 'valid val')]}
        self.assertRaises(TypeError, ttk._format_mapdict, invalid)
        # but when passing a single state, it can be anything
        valid = {'opt': [[1, 'value']]}
        self.assertEqual(ttk._format_mapdict(valid), ('-opt', '1 value'))
        # special attention to single states which evalute to False
        for stateval in (None, 0, False, '', set()): # just some samples
            valid = {'opt': [(stateval, 'value')]}
            self.assertEqual(ttk._format_mapdict(valid),
                ('-opt', '{} value'))

        # values must be iterable
        opts = {'a': None}
        self.assertRaises(TypeError, ttk._format_mapdict, opts)

        # items in the value must have size >= 2
        self.assertRaises(IndexError, ttk._format_mapdict,
            {'a': [('invalid', )]})


    def test_format_elemcreate(self):
        self.assertTrue(ttk._format_elemcreate(None), (None, ()))

        ## Testing type = image
        # image type expects at least an image name, so this should raise
        # IndexError since it tries to access the index 0 of an empty tuple
        self.assertRaises(IndexError, ttk._format_elemcreate, 'image')

        # don't format returned values as a tcl script
        # minimum acceptable for image type
        self.assertEqual(ttk._format_elemcreate('image', False, 'test'),
            ("test ", ()))
        # specifying a state spec
        self.assertEqual(ttk._format_elemcreate('image', False, 'test',
            ('', 'a')), ("test {} a", ()))
        # state spec with multiple states
        self.assertEqual(ttk._format_elemcreate('image', False, 'test',
            ('a', 'b', 'c')), ("test {a b} c", ()))
        # state spec and options
        res = ttk._format_elemcreate('image', False, 'test',
                                     ('a', 'b'), a='x', b='y')
        self.assertEqual(res[0], "test a b")
        self.assertEqual(set(res[1]), {"-a", "x", "-b", "y"})
        # format returned values as a tcl script
        # state spec with multiple states and an option with a multivalue
        self.assertEqual(ttk._format_elemcreate('image', True, 'test',
            ('a', 'b', 'c', 'd'), x=[2, 3]), ("{test {a b c} d}", "-x {2 3}"))

        ## Testing type = vsapi
        # vsapi type expects at least a class name and a part_id, so this
        # should raise a ValueError since it tries to get two elements from
        # an empty tuple
        self.assertRaises(ValueError, ttk._format_elemcreate, 'vsapi')

        # don't format returned values as a tcl script
        # minimum acceptable for vsapi
        self.assertEqual(ttk._format_elemcreate('vsapi', False, 'a', 'b'),
            ("a b ", ()))
        # now with a state spec with multiple states
        self.assertEqual(ttk._format_elemcreate('vsapi', False, 'a', 'b',
            ('a', 'b', 'c')), ("a b {a b} c", ()))
        # state spec and option
        self.assertEqual(ttk._format_elemcreate('vsapi', False, 'a', 'b',
            ('a', 'b'), opt='x'), ("a b a b", ("-opt", "x")))
        # format returned values as a tcl script
        # state spec with a multivalue and an option
        self.assertEqual(ttk._format_elemcreate('vsapi', True, 'a', 'b',
            ('a', 'b', [1, 2]), opt='x'), ("{a b {a b} {1 2}}", "-opt x"))

        # Testing type = from
        # from type expects at least a type name
        self.assertRaises(IndexError, ttk._format_elemcreate, 'from')

        self.assertEqual(ttk._format_elemcreate('from', False, 'a'),
            ('a', ()))
        self.assertEqual(ttk._format_elemcreate('from', False, 'a', 'b'),
            ('a', ('b', )))
        self.assertEqual(ttk._format_elemcreate('from', True, 'a', 'b'),
            ('{a}', 'b'))


    def test_format_layoutlist(self):
        def sample(indent=0, indent_size=2):
            return ttk._format_layoutlist(
            [('a', {'other': [1, 2, 3], 'children':
                [('b', {'children':
                    [('c', {'children':
                        [('d', {'nice': 'opt'})], 'something': (1, 2)
                    })]
                })]
            })], indent=indent, indent_size=indent_size)[0]

        def sample_expected(indent=0, indent_size=2):
            spaces = lambda amount=0: ' ' * (amount + indent)
            return (
                "%sa -other {1 2 3} -children {\n"
                "%sb -children {\n"
                "%sc -something {1 2} -children {\n"
                "%sd -nice opt\n"
                "%s}\n"
                "%s}\n"
                "%s}" % (spaces(), spaces(indent_size),
                    spaces(2 * indent_size), spaces(3 * indent_size),
                    spaces(2 * indent_size), spaces(indent_size), spaces()))

        # empty layout
        self.assertEqual(ttk._format_layoutlist([])[0], '')

        # smallest (after an empty one) acceptable layout
        smallest = ttk._format_layoutlist([('a', None)], indent=0)
        self.assertEqual(smallest,
            ttk._format_layoutlist([('a', '')], indent=0))
        self.assertEqual(smallest[0], 'a')

        # testing indentation levels
        self.assertEqual(sample(), sample_expected())
        for i in range(4):
            self.assertEqual(sample(i), sample_expected(i))
            self.assertEqual(sample(i, i), sample_expected(i, i))

        # invalid layout format, different kind of exceptions will be
        # raised

        # plain wrong format
        self.assertRaises(ValueError, ttk._format_layoutlist,
            ['bad', 'format'])
        self.assertRaises(TypeError, ttk._format_layoutlist, None)
        # _format_layoutlist always expects the second item (in every item)
        # to act like a dict (except when the value evalutes to False).
        self.assertRaises(AttributeError,
            ttk._format_layoutlist, [('a', 'b')])
        # bad children formatting
        self.assertRaises(ValueError, ttk._format_layoutlist,
            [('name', {'children': {'a': None}})])


    def test_script_from_settings(self):
        # empty options
        self.assertFalse(ttk._script_from_settings({'name':
            {'configure': None, 'map': None, 'element create': None}}))

        # empty layout
        self.assertEqual(
            ttk._script_from_settings({'name': {'layout': None}}),
            "ttk::style layout name {\nnull\n}")

        configdict = {u'αβγ': True, u'á': False}
        self.assertTrue(
            ttk._script_from_settings({'name': {'configure': configdict}}))

        mapdict = {u'üñíćódè': [(u'á', u'vãl')]}
        self.assertTrue(
            ttk._script_from_settings({'name': {'map': mapdict}}))

        # invalid image element
        self.assertRaises(IndexError,
            ttk._script_from_settings, {'name': {'element create': ['image']}})

        # minimal valid image
        self.assertTrue(ttk._script_from_settings({'name':
            {'element create': ['image', 'name']}}))

        image = {'thing': {'element create':
            ['image', 'name', ('state1', 'state2', 'val')]}}
        self.assertEqual(ttk._script_from_settings(image),
            "ttk::style element create thing image {name {state1 state2} val} ")

        image['thing']['element create'].append({'opt': 30})
        self.assertEqual(ttk._script_from_settings(image),
            "ttk::style element create thing image {name {state1 state2} val} "
            "-opt 30")

        image['thing']['element create'][-1]['opt'] = [MockTclObj(3),
            MockTclObj('2m')]
        self.assertEqual(ttk._script_from_settings(image),
            "ttk::style element create thing image {name {state1 state2} val} "
            "-opt {3 2m}")


    def test_tclobj_to_py(self):
        self.assertEqual(
            ttk._tclobj_to_py((MockStateSpec('a', 'b'), 'val')),
            [('a', 'b', 'val')])
        self.assertEqual(
            ttk._tclobj_to_py([MockTclObj('1'), 2, MockTclObj('3m')]),
            [1, 2, '3m'])


    def test_list_from_statespec(self):
        def test_it(sspec, value, res_value, states):
            self.assertEqual(ttk._list_from_statespec(
                (sspec, value)), [states + (res_value, )])

        states_even = tuple('state%d' % i for i in range(6))
        statespec = MockStateSpec(*states_even)
        test_it(statespec, 'val', 'val', states_even)
        test_it(statespec, MockTclObj('val'), 'val', states_even)

        states_odd = tuple('state%d' % i for i in range(5))
        statespec = MockStateSpec(*states_odd)
        test_it(statespec, 'val', 'val', states_odd)

        test_it(('a', 'b', 'c'), MockTclObj('val'), 'val', ('a', 'b', 'c'))


    def test_list_from_layouttuple(self):
        tk = MockTkApp()

        # empty layout tuple
        self.assertFalse(ttk._list_from_layouttuple(tk, ()))

        # shortest layout tuple
        self.assertEqual(ttk._list_from_layouttuple(tk, ('name', )),
            [('name', {})])

        # not so interesting ltuple
        sample_ltuple = ('name', '-option', 'value')
        self.assertEqual(ttk._list_from_layouttuple(tk, sample_ltuple),
            [('name', {'option': 'value'})])

        # empty children
        self.assertEqual(ttk._list_from_layouttuple(tk,
            ('something', '-children', ())),
            [('something', {'children': []})]
        )

        # more interesting ltuple
        ltuple = (
            'name', '-option', 'niceone', '-children', (
                ('otherone', '-children', (
                    ('child', )), '-otheropt', 'othervalue'
                )
            )
        )
        self.assertEqual(ttk._list_from_layouttuple(tk, ltuple),
            [('name', {'option': 'niceone', 'children':
                [('otherone', {'otheropt': 'othervalue', 'children':
                    [('child', {})]
                })]
            })]
        )

        # bad tuples
        self.assertRaises(ValueError, ttk._list_from_layouttuple, tk,
            ('name', 'no_minus'))
        self.assertRaises(ValueError, ttk._list_from_layouttuple, tk,
            ('name', 'no_minus', 'value'))
        self.assertRaises(ValueError, ttk._list_from_layouttuple, tk,
            ('something', '-children')) # no children


    def test_val_or_dict(self):
        def func(res, opt=None, val=None):
            if opt is None:
                return res
            if val is None:
                return "test val"
            return (opt, val)

        tk = MockTkApp()
        tk.call = func

        self.assertEqual(ttk._val_or_dict(tk, {}, '-test:3'),
                         {'test': '3'})
        self.assertEqual(ttk._val_or_dict(tk, {}, ('-test', 3)),
                         {'test': 3})

        self.assertEqual(ttk._val_or_dict(tk, {'test': None}, 'x:y'),
                         'test val')

        self.assertEqual(ttk._val_or_dict(tk, {'test': 3}, 'x:y'),
                         {'test': 3})


    def test_convert_stringval(self):
        tests = (
            (0, 0), ('09', 9), ('a', 'a'), (u'áÚ', u'áÚ'), ([], '[]'),
            (None, 'None')
        )
        for orig, expected in tests:
            self.assertEqual(ttk._convert_stringval(orig), expected)

        if sys.getdefaultencoding() == 'ascii':
            self.assertRaises(UnicodeDecodeError,
                ttk._convert_stringval, 'á')


class TclObjsToPyTest(unittest.TestCase):

    def test_unicode(self):
        adict = {'opt': u'välúè'}
        self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': u'välúè'})

        adict['opt'] = MockTclObj(adict['opt'])
        self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': u'välúè'})

    def test_multivalues(self):
        adict = {'opt': [1, 2, 3, 4]}
        self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': [1, 2, 3, 4]})

        adict['opt'] = [1, 'xm', 3]
        self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': [1, 'xm', 3]})

        adict['opt'] = (MockStateSpec('a', 'b'), u'válũè')
        self.assertEqual(ttk.tclobjs_to_py(adict),
            {'opt': [('a', 'b', u'válũè')]})

        self.assertEqual(ttk.tclobjs_to_py({'x': ['y z']}),
            {'x': ['y z']})

    def test_nosplit(self):
        self.assertEqual(ttk.tclobjs_to_py({'text': 'some text'}),
            {'text': 'some text'})

tests_nogui = (InternalFunctionsTest, TclObjsToPyTest)

if __name__ == "__main__":
    from test.test_support import run_unittest
    run_unittest(*tests_nogui)
test_ttk/test_functions.pyc000064400000037242150351526570012212 0ustar00�
zfc@s�ddlZddlZddlZdfd��YZdefd��YZdefd��YZdejfd	��YZd
ejfd��YZ	ee	fZ
edkr�dd
lm
Z
e
e
�ndS(i����Nt	MockTkAppcBseZd�Zd�ZRS(cCs t|t�r|S|jd�S(Nt:(t
isinstancettupletsplit(tselftarg((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyt	splitlistscCstS(N(tTrue(R((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pytwantobjects
s(t__name__t
__module__RR	(((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyRs	t
MockTclObjcBs eZdZd�Zd�ZRS(ttestcCs
||_dS(N(tval(RR((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyt__init__scCs
t|j�S(N(tunicodeR(R((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyt__str__s(R
RttypenameRR(((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyRs	t
MockStateSpeccBs eZdZd�Zd�ZRS(t	StateSpeccGs
||_dS(N(R(Rtargs((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyRscCsdj|j�S(Nt (tjoinR(R((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyR!s(R
RRRR(((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyRs	tInternalFunctionsTestcBsbeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
cs
�fd�}�jtji��|tjidd6ddddgd6�idd	6d
d6�|tjidBd6�idd6�|tjiidd6d6�iidd6d6�|tjiddddd
gd6dd6dd6dd6dd6dd6dd6dt�id d6d!d"6dd#6d$d%6d&d'6d(d)6d*d+6�itd,6td-6}|j�}|tj|�itd.6td/6��j||�|tjidCd26�id3d46�|tjidDd26�id6d46�|tjidEd26�id8d46�|tjidFd26�id:d46�|tjidGd26�id=d46�|tjidHd26�id?d46�ttj|d@d-��d}�j|t|�d�ttj|d@dI��d}�j|t|�d��jtj|d@|j���dS(JNcsfxEtdt|�d�D]+}�j|j||�||d�qW|rb�jd|�ndS(Niiisresult still got elements: %s(trangetlentassertEqualtpoptfail(tfmt_optstresultti(R(s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyt
check_against(s)tbluetfgiiiitpaddings-fgs1 2 3 4s-paddingtiR
s1 2 {} 0s-testsas istlefti����t2mttest2ttest3sabc defttest4s"abc"ttest5s{}ttest6s	} -spam {ttest7tscripts{1 -1 {} 2m 0}t3s-test2s-test3s	{abc def}s-test4s{"abc"}s-test5s\{\}s-test6s
\}\ -spam\ \{s-test7uαβγuáu-αβγu-ásone twotthreetoptions{one two} threes-optionsone	twos{one	two} threetones{} ones	one} {twosone\}\ \{two threes"one"ttwos{"one"} twos{one}s\{one\} twotignoretb(iiR%i(sone twoR0(sone	twoR0(R%R2(s	one} {twoR0(s"one"R3(s{one}R3(uáR5(	tassertFalsetttkt_format_optdictRtFalsetcopyRRtkeys(RR!toptst	orig_optstamount_opts((Rs;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_format_optdict'sl& $





cCsid!d"d#gd6}tj|�}|jt|�t|j��d	�|j|d$�|jtj|dt�d%�|jtjigd	6�d&�id'gd6}tj|�}|j|d(�id)gd6}|jtj|�d*�id+gd6}|jttj|�idgddfgd6}|jttj|�iddggd6}|jtj|�d,�xOddt	dt
�fD]5}i|dfgd6}|jtj|�d-�q�Widd6}|jttj|�|jttjid.gd6�dS(/NR5tcRtdtothervalR%tsingletais-as{b c} val d otherval {} singleR.s {{b c} val d otherval {} single}s-2uáuvãlu
üñíćódèu-üñíćódèuá vãluthitopts-opts{ } hiis	valid valt2tvalues1 valueis{} valuetinvalid(R5R@R(RARB(R%RC(s-as{b c} val d otherval {} single(s-as {{b c} val d otherval {} single}(s-2R%(uáuvãl(u-üñíćódèuá vãl(R%uRE(s-opts{ } hi(iis	valid val(s-opts1 value(s-opts{} value(RI(R7t_format_mapdictRRR;RtassertRaisest	TypeErrortNoneR9tsett
IndexError(RR<RtvalidRItstateval((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_format_mapdicts4& 
c
Cs�|jtjd�dd f�|jttjd�|jtjdtd�dd!f�|jtjdtdd"�dd#f�|jtjdtdd$�d	d%f�tjdtdd&dd
dd�}|j|dd
�|jt|d�dd
ddh�|jtjdt	dd'd
ddg�d(�|jt
tjd�|jtjdtdd�dd)f�|jtjdtddd*�dd+f�|jtjdtddd,dd
�dd-f�|jtjdt	ddddddgfdd
�d.�|jttjd�|jtjdtd�dd/f�|jtjdtdd�dd0f�|jtjdt	dd�d1�dS(2NtimageR
stest R%RDs	test {} aR5R@stest {a b} ctxtyistest a bis-as-bRAiis{test {a b c} d}s-x {2 3}tvsapisa b sa b {a b} cRFsa b a bs-opts{a b {a b} {1 2}}s-opt xtfroms{a}(((R%RD((RDR5R@((RDR5(RDR5R@RA(s{test {a b c} d}s-x {2 3}((RDR5R@((RDR5(s-optRT(s{a b {a b} {1 2}}s-opt x((R5(s{a}R5(t
assertTrueR7t_format_elemcreateRMRKRORR9RNRt
ValueError(Rtres((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_format_elemcreate�s<
&
"

cCspddd�}ddd�}|jtjg�dd�tjdgdd�}|j|tjdgdd��|j|dd�|j|�|��xRtd�D]D}|j||�||��|j|||�|||��q�W|jttjd	d
g�|jttjd�|jttjdg�|jttjdiidd6d
6fg�dS(NiicSsttjdidddgd6dididid	d
6fgd6dd6fgd6fgd6fgd
|d|�dS(NRDiiitotherR5R@RARFtnicetchildrent	somethingtindenttindent_sizei(ii(R7t_format_layoutlist(RaRb((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pytsample�s;cs_d�fd�}d|�||�|d|�|d|�|d|�||�|�fS(Nicsd|�S(NR((tamount(Ra(s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyt<lambda>�R%si%sa -other {1 2 3} -children {
%sb -children {
%sc -something {1 2} -children {
%sd -nice opt
%s}
%s}
%s}ii((RaRbtspaces((Ras;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pytsample_expected�s
R%RDRaitbadtformatR5tnameR_(RDN(RDR%(RDR5(	RR7RcRMRRKRZRLtAttributeError(RRdRhtsmallestR ((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_format_layoutlist�s$
	&
	cCs�|jtjiidd6dd6dd6d6��|jtjiidd6d6�d�itd6td6}|jtjii|d6d6��idgd
6}|jtjii|d6d6��|jt	tjiidgd6d6�|jtjiiddgd6d6��iidddgd6d6}|jtj|�d�|ddj
idd6�|jtj|�d�td�td�g|dddd<|jtj|�d�dS(Nt	configuretmapselement createRktlayoutsttk::style layout name {
null
}uαβγuáuvãlu
üñíćódèRStstate1tstate2RtthingsAttk::style element create thing image {name {state1 state2} val} iRFsHttk::style element create thing image {name {state1 state2} val} -opt 30iR'i����sLttk::style element create thing image {name {state1 state2} val} -opt {3 2m}(uáuvãl(RrRsR(R6R7t_script_from_settingsRMRRR9RXRKROtappendR(Rt
configdicttmapdictRS((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_script_from_settingss4#		cCsf|jtjtdd�df�dg�|jtjtd�dtd�g�dddg�dS(	NRDR5Rt1it3mi(RDR5R(RR7t
_tclobj_to_pyRR(R((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_tclobj_to_pyGs
!cs��fd�}td�td�D��}t|�}||dd|�||td�d|�td�td�D��}t|�}||dd|�|d
td�dd�dS(Ncs-�jtj||f�||fg�dS(N(RR7t_list_from_statespec(tsspecRHt	res_valuetstates(R(s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_itQscss|]}d|VqdS(sstate%dN((t.0R ((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pys	<genexpr>UsiRcss|]}d|VqdS(sstate%dN((R�R ((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pys	<genexpr>ZsiRDR5R@(RDR5R@(RDR5R@(RRRR(RR�tstates_event	statespect
states_odd((Rs;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_list_from_statespecPsc	Cstt�}|jtj|d��|jtj|d�difg�d}|jtj||�didd6fg�|jtj|dddf�digd6fg�ddddd	ddddff}|jtj||�didd6d	idd
6d
ifgd6fgd6fg�|jttj|d�|jttj|d�|jttj|d�dS(NRks-optionRHR1R`s	-childrenR_tniceonetotheronetchilds	-otheroptt
othervaluetotheropttno_minus((Rk(Rks-optionRH((R�(RkR�(RkR�RH(R`s	-children(RR6R7t_list_from_layouttupleRRKRZ(Rttkt
sample_ltupletltuple((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_list_from_layouttupleas.	

$cCs�ddd�}t�}||_|jtj|id�idd6�|jtj|id	�idd6�|jtj|idd6d�d�|jtj|idd6d�idd6�dS(
NcSs*|dkr|S|dkr dS||fS(Nstest val(RM(R[RFR((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pytfunc�s
s-test:3R/R
s-testisx:ystest val(s-testi(RMRtcallRR7t_val_or_dict(RR�R�((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_val_or_dict�s		cCs}d
ddd
gdfdf}x-|D]%\}}|jtj|�|�q%Wtj�dkry|jttjd	�ndS(Nit09i	RDuáÚs[]RMtasciisá(ii(R�i	(RDRD(uáÚuáÚ(NRM(RMRR7t_convert_stringvaltsystgetdefaultencodingRKtUnicodeDecodeError(Rtteststorigtexpected((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_convert_stringval�s		(R
RR?RRR\RnRyR}R�R�R�R�(((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyR%s	X	)	=	7	+				.	tTclObjsToPyTestcBs#eZd�Zd�Zd�ZRS(cCseidd6}|jtj|�idd6�t|d�|d<|jtj|�idd6�dS(NuvälúèRF(RR7t
tclobjs_to_pyR(Rtadict((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_unicode�s
 cCs�iddddgd6}|jtj|�iddddgd6�dddg|d<|jtj|�idddgd6�tdd�d	f|d<|jtj|�idgd6�|jtjid
gd6�id
gd6�dS(
NiiiiRFtxmRDR5uválũèsy zRT(RDR5uválũè(RR7R�R(RR�((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_multivalues�s,)cCs+|jtjidd6�idd6�dS(Ns	some textttext(RR7R�(R((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_nosplit�s(R
RR�R�R�(((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyR��s		t__main__(trun_unittest(R�tunittestR7RtobjectRRtTestCaseRR�ttests_noguiR
ttest.test_supportR�(((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyt<module>s

��test_ttk/support.pyc000064400000012334150351526600010644 0ustar00�
zfc@s�ddlZddlZddlZddlZddd��YZd�Zd�ZddlZe	e
eejj
d���Zd�Zdad�Zid	d
d6d	d6d	d
d6dd6Zd�Zd�Zd�ZdS(i����NtAbstractTkTestcBs8eZed��Zed��Zd�Zd�ZRS(cCs�tj|_t�tj�tj�|_|jj�|_|jjd�y|jj	dt
�Wntjk
r{nXdS(Ntnormals-zoomed(ttkintert_support_default_roott_old_support_default_roottdestroy_default_roott
NoDefaultRoottTktroottwantobjectstwm_statet
wm_attributestFalsetTclError(tcls((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyt
setUpClasss
cCs9|jj�|jj�|`dt_|jt_dS(N(Rtupdate_idletaskstdestroytNoneRt
_default_rootRR(R((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyt
tearDownClasss


	cCs|jj�dS(N(Rt	deiconify(tself((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pytsetUpscCs5x!|jj�D]}|j�qW|jj�dS(N(Rtwinfo_childrenRtwithdraw(Rtw((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyttearDown"s(t__name__t
__module__tclassmethodRRRR(((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyRs	cCs<ttdd�r8tjj�tjj�dt_ndS(NR(tgetattrRRRRR(((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyR's

cCsh|jddddd�|jdd|d|�|jdd|d|�|jdd|d|�dS(	sYGenerate proper events to click at the x, y position (tries to act
    like an X server).s<Enter>txitys<Motion>s<ButtonPress-1>s<ButtonRelease-1>N(tevent_generate(twidgetR R!((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pytsimulate_mouse_click-st.csQt��dkr>tjt�kddjtt����S�fd�}|S(Nisrequires Tcl version >= R%cs%tj����fd��}|S(NcsCt��kr5|jddjtt����n�|�dS(Nsrequires Tcl version >= R%(tget_tk_patchleveltskipTesttjointmaptstr(R(ttesttversion(s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pytnewtest?s	(t	functoolstwraps(R+R-(R,(R+s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pytdeco>s!(tlentunittestt
skipUnlessttcl_versionR(R)R*(R,R0((R,s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pytrequires_tcl9s
cCs�tdkr�tj�}|jdd�}tjd|�}|j�\}}}}t|�t|�t|�}}}idd6dd6dd	6|}|dkr�||||d
faq�||d
||fantS(Ntinfot
patchlevels(\d+)\.(\d+)([ab.])(\d+)$talphatatbetatbtfinalR%i(	t_tk_patchlevelRRtTcltcalltretmatchtgroupstint(ttclR7tmtmajortminortreleaseleveltserial((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyR&Is&iHgR���Q@tctigffffff9@REitpcCst|d �t|dS(Ni����(tfloattunits(tvalue((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pytpixels_conv_scCs�||krtSt|tj�rDt|t�rDt|�|kSnt|t�r�t|t�r�t|�t|�ko�td�t||�D��Snt	S(Ncss$|]\}}t||�VqdS(N(t
tcl_obj_eq(t.0tacttexp((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pys	<genexpr>ks(
tTruet
isinstancet_tkintertTcl_ObjR*ttupleR1talltzipR(tactualtexpected((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyRQbs	cCs]||krtSt|ttjf�rYt|ttjf�rYt|�t|�kSntS(N(RURVR*RtWidgetR(R\R]((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyt	widget_eqos((R.R@R2tTkinterRRRR$RWRYR)RCtTCL_VERSIONtsplitR4R5RR=R&RNRPRQR_(((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyt<module>s&!			!		
		
test_ttk/test_extensions.pyo000064400000023675150351526600012414 0ustar00�
zfc@s�ddlZddlZddlZddlZddlmZmZmZddl	m
Z
mZed�de
ejfd��YZ
de
ejfd��YZe
efZed	kr�ee�ndS(
i����N(trequirestrun_unittestt	swap_attr(tAbstractTkTesttdestroy_default_roottguitLabeledScaleTestcBsGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs$|jj�tt|�j�dS(N(troottupdate_idletaskstsuperRttearDown(tself((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyR
s
cCsltj|j�}|jj}|j�|jtj|j	j
|�tj|j�}|j}tj|jd|�}|j�|jr�|j
|j	j
|�|j��n(|j
t|j	j
|��|j��~|jtj|j	j
|�tj|j�}tj|jd|�}|j�tj|jd|�ttd�rh|jtjtj�ndS(Ntvariablet	last_type(tttktLabeledScaleRt	_variablet_nametdestroytassertRaisesttkintertTclErrorttktglobalgetvart	DoubleVartwantobjectstassertEqualtgettfloattIntVarthasattrtsystassertNotEqualR
(Rtxtvartmyvartname((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_widget_destroys&
	
	%(
cCs�ttdd���ttdt��izYtj�}|jtj�|j|j	tj�|j|j
tjj
�|j�Wdt�XWdQXWdQXdS(Nt
_default_roott_support_default_root(
RRtNonetTrueRRtassertIsNotNoneR&RtmasterRRR(RR!((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_initialization_no_master2scs�tj�j�}tj|�}�j|j|�|j�ddddtj	dtj	dff}�j
r}|d7}nxK|D]C}tj�jd|d�}�j|j|d�|j�q�Wtj�jdd	�}�jt
|jj�|j�tj�jdd�}�jt
|jj�|j�tj�jd
d�}tj�jd|�}�j|jd�|j�tj�jd|dd
�}�j|jd
��j|jj|j�|j��fd�}tj�jdd�}||jd|jd�|j�tj�jdd�}||jd|jd�|j�tj�jdd�}||jd|jd�|j�tj�j�}||jd|jd�|j��jtjtj|dd�dS(Nt0ii
i����ig@itfrom_s2.5tvalueiRg�?cs8�j|j�d|��j|j�d|�dS(Ntsidetanchor(Rt	pack_infot
place_info(tscalet	scale_postlabelt	label_pos(R(s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pytcheck_positionsastcompoundttoptbottomtntstunknowntatb(R-i(ii(i
i
(i����i����(g@i((g@i(RtFrameRRRRR+RRtmaxintRR/Rt
ValueErrorRRR(RRR4R6R(RR+R!tpassed_expectedtpairR#R8((Rs</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_initialization?sP
	 	









cCs^tj|jdddd�}|j�|j�|j�|jj�}|jj	�d}|j
|t|d��|jjdddd�|j�|jj	�d}|j
||�|jj�}|j
|jd|jr�dnd	�|j
|t|d��|jjdddd�|j
||�|j
|t|d��|j�dS(
NR.ittoi
R!i����ittextR-(RRRtpacktwait_visibilitytupdateR6R3R4tcoordsRtintt	configureR RR(Rtlscaletlinfo_1tprev_xcoordtcurr_xcoordtlinfo_2((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_horizontal_rangevs$



&cCsvtj|j�}|j�|j�|j�|jj�d}|jd}||_|j�|j	|j
d|jr�|n	t|��|j
|jj�d|�|j	|jj�dt|j
j�d��|jr�d�}nt}||jd�d|_|j�|j	||j
d�|�|j	|jj�dt|j
j�d��|j�dS(NiiRHR!cSs|S(N((R!((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyt<lambda>�tRG(RRRRIRJRKR4RLR/RR6Rtstrt
assertGreaterRMR3R(RR!RRtnewvaltconv((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_variable_change�s,



	
	
cCs�tj|j�}|jdtdd�|j�|j�|jj�|jj	�}}|d|d}}d|_
|j�|jjd||f�|jt
|jj�d�|jj�d�|jjd||f�|j�dS(	Ntexpandtfilltbothiis%dx%dR!i(RRRRIR)RJRKR+twinfo_widthtwinfo_heightR/twm_geometryRRMR6R3R4RLR(RR!twidththeightt	width_newt
height_new((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_resize�s

	
(	t__name__t
__module__R
R%R,RFRTR[Rf(((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyR
s		"	
	7		 tOptionMenuTestcBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs,tt|�j�tj|j�|_dS(N(R	RitsetUpRt	StringVarRttextvar(R((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyRj�scCs|`tt|�j�dS(N(RlR	RiR
(R((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyR
�scCs�tj|j�}tj|j|�}|j}|j�|j�|j|j	j
|�|j��~|jtj
|j	j
|�dS(N(RRkRRt
OptionMenuRRRRRRRRR(RR"toptmenuR$((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyR%�s	

"cCs�|jtjtj|j|jdd�tj|j|jddd�}|j|jj	�d�|j
|d�|j
|d�|j�dS(NtinvalidtthingR@R?tmenuttextvariable(RRRRRmRRlRRRt
assertTrueR(RRn((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyRF�s!c	s7d
�d}tj�j�j|��}t}xYtt���D]E}|dj|d�}�j|�|�||krCt	}qCqCW�j
|�|j�d}tj�j�j|��}d}d}xQt	r&||dj
|d�}}||kr	Pn�j||�|d7}q�W�j|t���|j�|j�|djd��j|jj��d��jtj|djd	��j|jj��d�|j�g����fd
�}tj�j�jdd|��}|djd��s)�jd�n|j�dS(NR?R@tcRqR/tdiii����cs%�j|�d��jt�dS(Ni(RtappendR)(titem(titemsRtsuccess(s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pytcb_teststcommandsMenu callback not invoked(R?R@Rt(RRmRRltFalsetrangetlent	entrycgetRR)RsRR(tentryconfigureR RIRJtinvokeRRRRRtfail(	RtdefaultRnt
found_defaulttiR/tcurrtlastRz((RxRRys</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyt	test_menu�sJ


	


	cCs;d	}d}tj|j|j||�}tj|j�}tj|j|||�}|j�|j�|j�|j�|djd�|djd�|dj	dd�}|dj	dd�}|j
||�|j|jjj
|�|d�|j|jjj
|�|d�|j�|j�dS(
NR?R@RtRqiiiR(R?R@Rt(RRmRRlRRkRIRJR�RR RRRR(RRxR�Rnttextvar2toptmenu2toptmenu_stringvar_nametoptmenu2_stringvar_name((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_unique_radiobuttonss*



	
(RgRhRjR
R%RFR�R�(((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyRi�s				
	4t__main__(RtunittesttTkinterRRttest.test_supportRRRttest_ttk.supportRRtTestCaseRRit	tests_guiRg(((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyt<module>s
�qtest_ttk/support.py000064400000007222150351526600010501 0ustar00import functools
import re
import unittest
import Tkinter as tkinter

class AbstractTkTest:

    @classmethod
    def setUpClass(cls):
        cls._old_support_default_root = tkinter._support_default_root
        destroy_default_root()
        tkinter.NoDefaultRoot()
        cls.root = tkinter.Tk()
        cls.wantobjects = cls.root.wantobjects()
        # De-maximize main window.
        # Some window managers can maximize new windows.
        cls.root.wm_state('normal')
        try:
            cls.root.wm_attributes('-zoomed', False)
        except tkinter.TclError:
            pass

    @classmethod
    def tearDownClass(cls):
        cls.root.update_idletasks()
        cls.root.destroy()
        del cls.root
        tkinter._default_root = None
        tkinter._support_default_root = cls._old_support_default_root

    def setUp(self):
        self.root.deiconify()

    def tearDown(self):
        for w in self.root.winfo_children():
            w.destroy()
        self.root.withdraw()

def destroy_default_root():
    if getattr(tkinter, '_default_root', None):
        tkinter._default_root.update_idletasks()
        tkinter._default_root.destroy()
        tkinter._default_root = None

def simulate_mouse_click(widget, x, y):
    """Generate proper events to click at the x, y position (tries to act
    like an X server)."""
    widget.event_generate('<Enter>', x=0, y=0)
    widget.event_generate('<Motion>', x=x, y=y)
    widget.event_generate('<ButtonPress-1>', x=x, y=y)
    widget.event_generate('<ButtonRelease-1>', x=x, y=y)


import _tkinter
tcl_version = tuple(map(int, _tkinter.TCL_VERSION.split('.')))

def requires_tcl(*version):
    if len(version) <= 2:
        return unittest.skipUnless(tcl_version >= version,
            'requires Tcl version >= ' + '.'.join(map(str, version)))

    def deco(test):
        @functools.wraps(test)
        def newtest(self):
            if get_tk_patchlevel() < version:
                self.skipTest('requires Tcl version >= ' +
                                '.'.join(map(str, version)))
            test(self)
        return newtest
    return deco

_tk_patchlevel = None
def get_tk_patchlevel():
    global _tk_patchlevel
    if _tk_patchlevel is None:
        tcl = tkinter.Tcl()
        patchlevel = tcl.call('info', 'patchlevel')
        m = re.match(r'(\d+)\.(\d+)([ab.])(\d+)$', patchlevel)
        major, minor, releaselevel, serial = m.groups()
        major, minor, serial = int(major), int(minor), int(serial)
        releaselevel = {'a': 'alpha', 'b': 'beta', '.': 'final'}[releaselevel]
        if releaselevel == 'final':
            _tk_patchlevel = major, minor, serial, releaselevel, 0
        else:
            _tk_patchlevel = major, minor, 0, releaselevel, serial
    return _tk_patchlevel

units = {
    'c': 72 / 2.54,     # centimeters
    'i': 72,            # inches
    'm': 72 / 25.4,     # millimeters
    'p': 1,             # points
}

def pixels_conv(value):
    return float(value[:-1]) * units[value[-1:]]

def tcl_obj_eq(actual, expected):
    if actual == expected:
        return True
    if isinstance(actual, _tkinter.Tcl_Obj):
        if isinstance(expected, str):
            return str(actual) == expected
    if isinstance(actual, tuple):
        if isinstance(expected, tuple):
            return (len(actual) == len(expected) and
                    all(tcl_obj_eq(act, exp)
                        for act, exp in zip(actual, expected)))
    return False

def widget_eq(actual, expected):
    if actual == expected:
        return True
    if isinstance(actual, (str, tkinter.Widget)):
        if isinstance(expected, (str, tkinter.Widget)):
            return str(actual) == str(expected)
    return False
test_ttk/test_functions.pyo000064400000037242150351526600012220 0ustar00�
zfc@s�ddlZddlZddlZdfd��YZdefd��YZdefd��YZdejfd	��YZd
ejfd��YZ	ee	fZ
edkr�dd
lm
Z
e
e
�ndS(i����Nt	MockTkAppcBseZd�Zd�ZRS(cCs t|t�r|S|jd�S(Nt:(t
isinstancettupletsplit(tselftarg((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyt	splitlistscCstS(N(tTrue(R((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pytwantobjects
s(t__name__t
__module__RR	(((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyRs	t
MockTclObjcBs eZdZd�Zd�ZRS(ttestcCs
||_dS(N(tval(RR((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyt__init__scCs
t|j�S(N(tunicodeR(R((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyt__str__s(R
RttypenameRR(((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyRs	t
MockStateSpeccBs eZdZd�Zd�ZRS(t	StateSpeccGs
||_dS(N(R(Rtargs((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyRscCsdj|j�S(Nt (tjoinR(R((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyR!s(R
RRRR(((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyRs	tInternalFunctionsTestcBsbeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
cs
�fd�}�jtji��|tjidd6ddddgd6�idd	6d
d6�|tjidBd6�idd6�|tjiidd6d6�iidd6d6�|tjiddddd
gd6dd6dd6dd6dd6dd6dd6dt�id d6d!d"6dd#6d$d%6d&d'6d(d)6d*d+6�itd,6td-6}|j�}|tj|�itd.6td/6��j||�|tjidCd26�id3d46�|tjidDd26�id6d46�|tjidEd26�id8d46�|tjidFd26�id:d46�|tjidGd26�id=d46�|tjidHd26�id?d46�ttj|d@d-��d}�j|t|�d�ttj|d@dI��d}�j|t|�d��jtj|d@|j���dS(JNcsfxEtdt|�d�D]+}�j|j||�||d�qW|rb�jd|�ndS(Niiisresult still got elements: %s(trangetlentassertEqualtpoptfail(tfmt_optstresultti(R(s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyt
check_against(s)tbluetfgiiiitpaddings-fgs1 2 3 4s-paddingtiR
s1 2 {} 0s-testsas istlefti����t2mttest2ttest3sabc defttest4s"abc"ttest5s{}ttest6s	} -spam {ttest7tscripts{1 -1 {} 2m 0}t3s-test2s-test3s	{abc def}s-test4s{"abc"}s-test5s\{\}s-test6s
\}\ -spam\ \{s-test7uαβγuáu-αβγu-ásone twotthreetoptions{one two} threes-optionsone	twos{one	two} threetones{} ones	one} {twosone\}\ \{two threes"one"ttwos{"one"} twos{one}s\{one\} twotignoretb(iiR%i(sone twoR0(sone	twoR0(R%R2(s	one} {twoR0(s"one"R3(s{one}R3(uáR5(	tassertFalsetttkt_format_optdictRtFalsetcopyRRtkeys(RR!toptst	orig_optstamount_opts((Rs;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_format_optdict'sl& $





cCsid!d"d#gd6}tj|�}|jt|�t|j��d	�|j|d$�|jtj|dt�d%�|jtjigd	6�d&�id'gd6}tj|�}|j|d(�id)gd6}|jtj|�d*�id+gd6}|jttj|�idgddfgd6}|jttj|�iddggd6}|jtj|�d,�xOddt	dt
�fD]5}i|dfgd6}|jtj|�d-�q�Widd6}|jttj|�|jttjid.gd6�dS(/NR5tcRtdtothervalR%tsingletais-as{b c} val d otherval {} singleR.s {{b c} val d otherval {} single}s-2uáuvãlu
üñíćódèu-üñíćódèuá vãluthitopts-opts{ } hiis	valid valt2tvalues1 valueis{} valuetinvalid(R5R@R(RARB(R%RC(s-as{b c} val d otherval {} single(s-as {{b c} val d otherval {} single}(s-2R%(uáuvãl(u-üñíćódèuá vãl(R%uRE(s-opts{ } hi(iis	valid val(s-opts1 value(s-opts{} value(RI(R7t_format_mapdictRRR;RtassertRaisest	TypeErrortNoneR9tsett
IndexError(RR<RtvalidRItstateval((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_format_mapdicts4& 
c
Cs�|jtjd�dd f�|jttjd�|jtjdtd�dd!f�|jtjdtdd"�dd#f�|jtjdtdd$�d	d%f�tjdtdd&dd
dd�}|j|dd
�|jt|d�dd
ddh�|jtjdt	dd'd
ddg�d(�|jt
tjd�|jtjdtdd�dd)f�|jtjdtddd*�dd+f�|jtjdtddd,dd
�dd-f�|jtjdt	ddddddgfdd
�d.�|jttjd�|jtjdtd�dd/f�|jtjdtdd�dd0f�|jtjdt	dd�d1�dS(2NtimageR
stest R%RDs	test {} aR5R@stest {a b} ctxtyistest a bis-as-bRAiis{test {a b c} d}s-x {2 3}tvsapisa b sa b {a b} cRFsa b a bs-opts{a b {a b} {1 2}}s-opt xtfroms{a}(((R%RD((RDR5R@((RDR5(RDR5R@RA(s{test {a b c} d}s-x {2 3}((RDR5R@((RDR5(s-optRT(s{a b {a b} {1 2}}s-opt x((R5(s{a}R5(t
assertTrueR7t_format_elemcreateRMRKRORR9RNRt
ValueError(Rtres((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_format_elemcreate�s<
&
"

cCspddd�}ddd�}|jtjg�dd�tjdgdd�}|j|tjdgdd��|j|dd�|j|�|��xRtd�D]D}|j||�||��|j|||�|||��q�W|jttjd	d
g�|jttjd�|jttjdg�|jttjdiidd6d
6fg�dS(NiicSsttjdidddgd6dididid	d
6fgd6dd6fgd6fgd6fgd
|d|�dS(NRDiiitotherR5R@RARFtnicetchildrent	somethingtindenttindent_sizei(ii(R7t_format_layoutlist(RaRb((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pytsample�s;cs_d�fd�}d|�||�|d|�|d|�|d|�||�|�fS(Nicsd|�S(NR((tamount(Ra(s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyt<lambda>�R%si%sa -other {1 2 3} -children {
%sb -children {
%sc -something {1 2} -children {
%sd -nice opt
%s}
%s}
%s}ii((RaRbtspaces((Ras;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pytsample_expected�s
R%RDRaitbadtformatR5tnameR_(RDN(RDR%(RDR5(	RR7RcRMRRKRZRLtAttributeError(RRdRhtsmallestR ((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_format_layoutlist�s$
	&
	cCs�|jtjiidd6dd6dd6d6��|jtjiidd6d6�d�itd6td6}|jtjii|d6d6��idgd
6}|jtjii|d6d6��|jt	tjiidgd6d6�|jtjiiddgd6d6��iidddgd6d6}|jtj|�d�|ddj
idd6�|jtj|�d�td�td�g|dddd<|jtj|�d�dS(Nt	configuretmapselement createRktlayoutsttk::style layout name {
null
}uαβγuáuvãlu
üñíćódèRStstate1tstate2RtthingsAttk::style element create thing image {name {state1 state2} val} iRFsHttk::style element create thing image {name {state1 state2} val} -opt 30iR'i����sLttk::style element create thing image {name {state1 state2} val} -opt {3 2m}(uáuvãl(RrRsR(R6R7t_script_from_settingsRMRRR9RXRKROtappendR(Rt
configdicttmapdictRS((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_script_from_settingss4#		cCsf|jtjtdd�df�dg�|jtjtd�dtd�g�dddg�dS(	NRDR5Rt1it3mi(RDR5R(RR7t
_tclobj_to_pyRR(R((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_tclobj_to_pyGs
!cs��fd�}td�td�D��}t|�}||dd|�||td�d|�td�td�D��}t|�}||dd|�|d
td�dd�dS(Ncs-�jtj||f�||fg�dS(N(RR7t_list_from_statespec(tsspecRHt	res_valuetstates(R(s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_itQscss|]}d|VqdS(sstate%dN((t.0R ((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pys	<genexpr>UsiRcss|]}d|VqdS(sstate%dN((R�R ((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pys	<genexpr>ZsiRDR5R@(RDR5R@(RDR5R@(RRRR(RR�tstates_event	statespect
states_odd((Rs;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_list_from_statespecPsc	Cstt�}|jtj|d��|jtj|d�difg�d}|jtj||�didd6fg�|jtj|dddf�digd6fg�ddddd	ddddff}|jtj||�didd6d	idd
6d
ifgd6fgd6fg�|jttj|d�|jttj|d�|jttj|d�dS(NRks-optionRHR1R`s	-childrenR_tniceonetotheronetchilds	-otheroptt
othervaluetotheropttno_minus((Rk(Rks-optionRH((R�(RkR�(RkR�RH(R`s	-children(RR6R7t_list_from_layouttupleRRKRZ(Rttkt
sample_ltupletltuple((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_list_from_layouttupleas.	

$cCs�ddd�}t�}||_|jtj|id�idd6�|jtj|id	�idd6�|jtj|idd6d�d�|jtj|idd6d�idd6�dS(
NcSs*|dkr|S|dkr dS||fS(Nstest val(RM(R[RFR((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pytfunc�s
s-test:3R/R
s-testisx:ystest val(s-testi(RMRtcallRR7t_val_or_dict(RR�R�((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_val_or_dict�s		cCs}d
ddd
gdfdf}x-|D]%\}}|jtj|�|�q%Wtj�dkry|jttjd	�ndS(Nit09i	RDuáÚs[]RMtasciisá(ii(R�i	(RDRD(uáÚuáÚ(NRM(RMRR7t_convert_stringvaltsystgetdefaultencodingRKtUnicodeDecodeError(Rtteststorigtexpected((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_convert_stringval�s		(R
RR?RRR\RnRyR}R�R�R�R�(((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyR%s	X	)	=	7	+				.	tTclObjsToPyTestcBs#eZd�Zd�Zd�ZRS(cCseidd6}|jtj|�idd6�t|d�|d<|jtj|�idd6�dS(NuvälúèRF(RR7t
tclobjs_to_pyR(Rtadict((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_unicode�s
 cCs�iddddgd6}|jtj|�iddddgd6�dddg|d<|jtj|�idddgd6�tdd�d	f|d<|jtj|�idgd6�|jtjid
gd6�id
gd6�dS(
NiiiiRFtxmRDR5uválũèsy zRT(RDR5uválũè(RR7R�R(RR�((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_multivalues�s,)cCs+|jtjidd6�idd6�dS(Ns	some textttext(RR7R�(R((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_nosplit�s(R
RR�R�R�(((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyR��s		t__main__(trun_unittest(R�tunittestR7RtobjectRRtTestCaseRR�ttests_noguiR
ttest.test_supportR�(((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyt<module>s

��test_ttk/test_extensions.py000064400000026325150351526600012230 0ustar00import sys
import unittest
import Tkinter as tkinter
import ttk
from test.test_support import requires, run_unittest, swap_attr
from test_ttk.support import AbstractTkTest, destroy_default_root

requires('gui')

class LabeledScaleTest(AbstractTkTest, unittest.TestCase):

    def tearDown(self):
        self.root.update_idletasks()
        super(LabeledScaleTest, self).tearDown()

    def test_widget_destroy(self):
        # automatically created variable
        x = ttk.LabeledScale(self.root)
        var = x._variable._name
        x.destroy()
        self.assertRaises(tkinter.TclError, x.tk.globalgetvar, var)

        # manually created variable
        myvar = tkinter.DoubleVar(self.root)
        name = myvar._name
        x = ttk.LabeledScale(self.root, variable=myvar)
        x.destroy()
        if self.wantobjects:
            self.assertEqual(x.tk.globalgetvar(name), myvar.get())
        else:
            self.assertEqual(float(x.tk.globalgetvar(name)), myvar.get())
        del myvar
        self.assertRaises(tkinter.TclError, x.tk.globalgetvar, name)

        # checking that the tracing callback is properly removed
        myvar = tkinter.IntVar(self.root)
        # LabeledScale will start tracing myvar
        x = ttk.LabeledScale(self.root, variable=myvar)
        x.destroy()
        # Unless the tracing callback was removed, creating a new
        # LabeledScale with the same var will cause an error now. This
        # happens because the variable will be set to (possibly) a new
        # value which causes the tracing callback to be called and then
        # it tries calling instance attributes not yet defined.
        ttk.LabeledScale(self.root, variable=myvar)
        if hasattr(sys, 'last_type'):
            self.assertNotEqual(sys.last_type, tkinter.TclError)


    def test_initialization_no_master(self):
        # no master passing
        with swap_attr(tkinter, '_default_root', None), \
             swap_attr(tkinter, '_support_default_root', True):
            try:
                x = ttk.LabeledScale()
                self.assertIsNotNone(tkinter._default_root)
                self.assertEqual(x.master, tkinter._default_root)
                self.assertEqual(x.tk, tkinter._default_root.tk)
                x.destroy()
            finally:
                destroy_default_root()

    def test_initialization(self):
        # master passing
        master = tkinter.Frame(self.root)
        x = ttk.LabeledScale(master)
        self.assertEqual(x.master, master)
        x.destroy()

        # variable initialization/passing
        passed_expected = (('0', 0), (0, 0), (10, 10),
            (-1, -1), (sys.maxint + 1, sys.maxint + 1))
        if self.wantobjects:
            passed_expected += ((2.5, 2),)
        for pair in passed_expected:
            x = ttk.LabeledScale(self.root, from_=pair[0])
            self.assertEqual(x.value, pair[1])
            x.destroy()
        x = ttk.LabeledScale(self.root, from_='2.5')
        self.assertRaises(ValueError, x._variable.get)
        x.destroy()
        x = ttk.LabeledScale(self.root, from_=None)
        self.assertRaises(ValueError, x._variable.get)
        x.destroy()
        # variable should have its default value set to the from_ value
        myvar = tkinter.DoubleVar(self.root, value=20)
        x = ttk.LabeledScale(self.root, variable=myvar)
        self.assertEqual(x.value, 0)
        x.destroy()
        # check that it is really using a DoubleVar
        x = ttk.LabeledScale(self.root, variable=myvar, from_=0.5)
        self.assertEqual(x.value, 0.5)
        self.assertEqual(x._variable._name, myvar._name)
        x.destroy()

        # widget positionment
        def check_positions(scale, scale_pos, label, label_pos):
            self.assertEqual(scale.pack_info()['side'], scale_pos)
            self.assertEqual(label.place_info()['anchor'], label_pos)
        x = ttk.LabeledScale(self.root, compound='top')
        check_positions(x.scale, 'bottom', x.label, 'n')
        x.destroy()
        x = ttk.LabeledScale(self.root, compound='bottom')
        check_positions(x.scale, 'top', x.label, 's')
        x.destroy()
        # invert default positions
        x = ttk.LabeledScale(self.root, compound='unknown')
        check_positions(x.scale, 'top', x.label, 's')
        x.destroy()
        x = ttk.LabeledScale(self.root) # take default positions
        check_positions(x.scale, 'bottom', x.label, 'n')
        x.destroy()

        # extra, and invalid, kwargs
        self.assertRaises(tkinter.TclError, ttk.LabeledScale, master, a='b')


    def test_horizontal_range(self):
        lscale = ttk.LabeledScale(self.root, from_=0, to=10)
        lscale.pack()
        lscale.wait_visibility()
        lscale.update()

        linfo_1 = lscale.label.place_info()
        prev_xcoord = lscale.scale.coords()[0]
        self.assertEqual(prev_xcoord, int(linfo_1['x']))
        # change range to: from -5 to 5. This should change the x coord of
        # the scale widget, since 0 is at the middle of the new
        # range.
        lscale.scale.configure(from_=-5, to=5)
        # The following update is needed since the test doesn't use mainloop,
        # at the same time this shouldn't affect test outcome
        lscale.update()
        curr_xcoord = lscale.scale.coords()[0]
        self.assertNotEqual(prev_xcoord, curr_xcoord)
        # the label widget should have been repositioned too
        linfo_2 = lscale.label.place_info()
        self.assertEqual(lscale.label['text'], 0 if self.wantobjects else '0')
        self.assertEqual(curr_xcoord, int(linfo_2['x']))
        # change the range back
        lscale.scale.configure(from_=0, to=10)
        self.assertNotEqual(prev_xcoord, curr_xcoord)
        self.assertEqual(prev_xcoord, int(linfo_1['x']))

        lscale.destroy()


    def test_variable_change(self):
        x = ttk.LabeledScale(self.root)
        x.pack()
        x.wait_visibility()
        x.update()

        curr_xcoord = x.scale.coords()[0]
        newval = x.value + 1
        x.value = newval
        # The following update is needed since the test doesn't use mainloop,
        # at the same time this shouldn't affect test outcome
        x.update()
        self.assertEqual(x.label['text'],
                         newval if self.wantobjects else str(newval))
        self.assertGreater(x.scale.coords()[0], curr_xcoord)
        self.assertEqual(x.scale.coords()[0],
            int(x.label.place_info()['x']))

        # value outside range
        if self.wantobjects:
            conv = lambda x: x
        else:
            conv = int
        x.value = conv(x.scale['to']) + 1 # no changes shouldn't happen
        x.update()
        self.assertEqual(conv(x.label['text']), newval)
        self.assertEqual(x.scale.coords()[0],
            int(x.label.place_info()['x']))

        x.destroy()


    def test_resize(self):
        x = ttk.LabeledScale(self.root)
        x.pack(expand=True, fill='both')
        x.wait_visibility()
        x.update()

        width, height = x.master.winfo_width(), x.master.winfo_height()
        width_new, height_new = width * 2, height * 2

        x.value = 3
        x.update()
        x.master.wm_geometry("%dx%d" % (width_new, height_new))
        self.assertEqual(int(x.label.place_info()['x']),
            x.scale.coords()[0])

        # Reset geometry
        x.master.wm_geometry("%dx%d" % (width, height))
        x.destroy()


class OptionMenuTest(AbstractTkTest, unittest.TestCase):

    def setUp(self):
        super(OptionMenuTest, self).setUp()
        self.textvar = tkinter.StringVar(self.root)

    def tearDown(self):
        del self.textvar
        super(OptionMenuTest, self).tearDown()


    def test_widget_destroy(self):
        var = tkinter.StringVar(self.root)
        optmenu = ttk.OptionMenu(self.root, var)
        name = var._name
        optmenu.update_idletasks()
        optmenu.destroy()
        self.assertEqual(optmenu.tk.globalgetvar(name), var.get())
        del var
        self.assertRaises(tkinter.TclError, optmenu.tk.globalgetvar, name)


    def test_initialization(self):
        self.assertRaises(tkinter.TclError,
            ttk.OptionMenu, self.root, self.textvar, invalid='thing')

        optmenu = ttk.OptionMenu(self.root, self.textvar, 'b', 'a', 'b')
        self.assertEqual(optmenu._variable.get(), 'b')

        self.assertTrue(optmenu['menu'])
        self.assertTrue(optmenu['textvariable'])

        optmenu.destroy()


    def test_menu(self):
        items = ('a', 'b', 'c')
        default = 'a'
        optmenu = ttk.OptionMenu(self.root, self.textvar, default, *items)
        found_default = False
        for i in range(len(items)):
            value = optmenu['menu'].entrycget(i, 'value')
            self.assertEqual(value, items[i])
            if value == default:
                found_default = True
        self.assertTrue(found_default)
        optmenu.destroy()

        # default shouldn't be in menu if it is not part of values
        default = 'd'
        optmenu = ttk.OptionMenu(self.root, self.textvar, default, *items)
        curr = None
        i = 0
        while True:
            last, curr = curr, optmenu['menu'].entryconfigure(i, 'value')
            if last == curr:
                # no more menu entries
                break
            self.assertNotEqual(curr, default)
            i += 1
        self.assertEqual(i, len(items))

        # check that variable is updated correctly
        optmenu.pack()
        optmenu.wait_visibility()
        optmenu['menu'].invoke(0)
        self.assertEqual(optmenu._variable.get(), items[0])

        # changing to an invalid index shouldn't change the variable
        self.assertRaises(tkinter.TclError, optmenu['menu'].invoke, -1)
        self.assertEqual(optmenu._variable.get(), items[0])

        optmenu.destroy()

        # specifying a callback
        success = []
        def cb_test(item):
            self.assertEqual(item, items[1])
            success.append(True)
        optmenu = ttk.OptionMenu(self.root, self.textvar, 'a', command=cb_test,
            *items)
        optmenu['menu'].invoke(1)
        if not success:
            self.fail("Menu callback not invoked")

        optmenu.destroy()

    def test_unique_radiobuttons(self):
        # check that radiobuttons are unique across instances (bpo25684)
        items = ('a', 'b', 'c')
        default = 'a'
        optmenu = ttk.OptionMenu(self.root, self.textvar, default, *items)
        textvar2 = tkinter.StringVar(self.root)
        optmenu2 = ttk.OptionMenu(self.root, textvar2, default, *items)
        optmenu.pack()
        optmenu.wait_visibility()
        optmenu2.pack()
        optmenu2.wait_visibility()
        optmenu['menu'].invoke(1)
        optmenu2['menu'].invoke(2)
        optmenu_stringvar_name = optmenu['menu'].entrycget(0, 'variable')
        optmenu2_stringvar_name = optmenu2['menu'].entrycget(0, 'variable')
        self.assertNotEqual(optmenu_stringvar_name,
                            optmenu2_stringvar_name)
        self.assertEqual(self.root.tk.globalgetvar(optmenu_stringvar_name),
                         items[1])
        self.assertEqual(self.root.tk.globalgetvar(optmenu2_stringvar_name),
                         items[2])

        optmenu.destroy()
        optmenu2.destroy()


tests_gui = (LabeledScaleTest, OptionMenuTest)

if __name__ == "__main__":
    run_unittest(*tests_gui)
test_ttk/support.pyo000064400000012334150351526600010660 0ustar00�
zfc@s�ddlZddlZddlZddlZddd��YZd�Zd�ZddlZe	e
eejj
d���Zd�Zdad�Zid	d
d6d	d6d	d
d6dd6Zd�Zd�Zd�ZdS(i����NtAbstractTkTestcBs8eZed��Zed��Zd�Zd�ZRS(cCs�tj|_t�tj�tj�|_|jj�|_|jjd�y|jj	dt
�Wntjk
r{nXdS(Ntnormals-zoomed(ttkintert_support_default_roott_old_support_default_roottdestroy_default_roott
NoDefaultRoottTktroottwantobjectstwm_statet
wm_attributestFalsetTclError(tcls((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyt
setUpClasss
cCs9|jj�|jj�|`dt_|jt_dS(N(Rtupdate_idletaskstdestroytNoneRt
_default_rootRR(R((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyt
tearDownClasss


	cCs|jj�dS(N(Rt	deiconify(tself((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pytsetUpscCs5x!|jj�D]}|j�qW|jj�dS(N(Rtwinfo_childrenRtwithdraw(Rtw((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyttearDown"s(t__name__t
__module__tclassmethodRRRR(((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyRs	cCs<ttdd�r8tjj�tjj�dt_ndS(NR(tgetattrRRRRR(((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyR's

cCsh|jddddd�|jdd|d|�|jdd|d|�|jdd|d|�dS(	sYGenerate proper events to click at the x, y position (tries to act
    like an X server).s<Enter>txitys<Motion>s<ButtonPress-1>s<ButtonRelease-1>N(tevent_generate(twidgetR R!((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pytsimulate_mouse_click-st.csQt��dkr>tjt�kddjtt����S�fd�}|S(Nisrequires Tcl version >= R%cs%tj����fd��}|S(NcsCt��kr5|jddjtt����n�|�dS(Nsrequires Tcl version >= R%(tget_tk_patchleveltskipTesttjointmaptstr(R(ttesttversion(s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pytnewtest?s	(t	functoolstwraps(R+R-(R,(R+s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pytdeco>s!(tlentunittestt
skipUnlessttcl_versionR(R)R*(R,R0((R,s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pytrequires_tcl9s
cCs�tdkr�tj�}|jdd�}tjd|�}|j�\}}}}t|�t|�t|�}}}idd6dd6dd	6|}|dkr�||||d
faq�||d
||fantS(Ntinfot
patchlevels(\d+)\.(\d+)([ab.])(\d+)$talphatatbetatbtfinalR%i(	t_tk_patchlevelRRtTcltcalltretmatchtgroupstint(ttclR7tmtmajortminortreleaseleveltserial((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyR&Is&iHgR���Q@tctigffffff9@REitpcCst|d �t|dS(Ni����(tfloattunits(tvalue((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pytpixels_conv_scCs�||krtSt|tj�rDt|t�rDt|�|kSnt|t�r�t|t�r�t|�t|�ko�td�t||�D��Snt	S(Ncss$|]\}}t||�VqdS(N(t
tcl_obj_eq(t.0tacttexp((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pys	<genexpr>ks(
tTruet
isinstancet_tkintertTcl_ObjR*ttupleR1talltzipR(tactualtexpected((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyRQbs	cCs]||krtSt|ttjf�rYt|ttjf�rYt|�t|�kSntS(N(RURVR*RtWidgetR(R\R]((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyt	widget_eqos((R.R@R2tTkinterRRRR$RWRYR)RCtTCL_VERSIONtsplitR4R5RR=R&RNRPRQR_(((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyt<module>s&!			!		
		
test_ttk/test_style.py000064400000005542150351526600011167 0ustar00import unittest
import Tkinter as tkinter
import ttk
from test.test_support import requires, run_unittest
from test_ttk.support import AbstractTkTest

requires('gui')

class StyleTest(AbstractTkTest, unittest.TestCase):

    def setUp(self):
        super(StyleTest, self).setUp()
        self.style = ttk.Style(self.root)


    def test_configure(self):
        style = self.style
        style.configure('TButton', background='yellow')
        self.assertEqual(style.configure('TButton', 'background'),
            'yellow')
        self.assertIsInstance(style.configure('TButton'), dict)


    def test_map(self):
        style = self.style
        style.map('TButton', background=[('active', 'background', 'blue')])
        self.assertEqual(style.map('TButton', 'background'),
            [('active', 'background', 'blue')] if self.wantobjects else
            [('active background', 'blue')])
        self.assertIsInstance(style.map('TButton'), dict)


    def test_lookup(self):
        style = self.style
        style.configure('TButton', background='yellow')
        style.map('TButton', background=[('active', 'background', 'blue')])

        self.assertEqual(style.lookup('TButton', 'background'), 'yellow')
        self.assertEqual(style.lookup('TButton', 'background',
            ['active', 'background']), 'blue')
        self.assertEqual(style.lookup('TButton', 'optionnotdefined',
            default='iknewit'), 'iknewit')


    def test_layout(self):
        style = self.style
        self.assertRaises(tkinter.TclError, style.layout, 'NotALayout')
        tv_style = style.layout('Treeview')

        # "erase" Treeview layout
        style.layout('Treeview', '')
        self.assertEqual(style.layout('Treeview'),
            [('null', {'sticky': 'nswe'})]
        )

        # restore layout
        style.layout('Treeview', tv_style)
        self.assertEqual(style.layout('Treeview'), tv_style)

        # should return a list
        self.assertIsInstance(style.layout('TButton'), list)

        # correct layout, but "option" doesn't exist as option
        self.assertRaises(tkinter.TclError, style.layout, 'Treeview',
            [('name', {'option': 'inexistent'})])


    def test_theme_use(self):
        self.assertRaises(tkinter.TclError, self.style.theme_use,
            'nonexistingname')

        curr_theme = self.style.theme_use()
        new_theme = None
        for theme in self.style.theme_names():
            if theme != curr_theme:
                new_theme = theme
                self.style.theme_use(theme)
                break
        else:
            # just one theme available, can't go on with tests
            return

        self.assertFalse(curr_theme == new_theme)
        self.assertFalse(new_theme != self.style.theme_use())

        self.style.theme_use(curr_theme)


tests_gui = (StyleTest, )

if __name__ == "__main__":
    run_unittest(*tests_gui)
test_ttk/test_widgets.pyo000064400000170617150351526610011663 0ustar00�
zfc@sUddlZddlZddlmZddlZddlmZmZmZm	Z	ddl
Z
ddlmZddl
mZmZmZmZddlmZmZmZmZmZmZmZmZed�defd	��YZd
eejfd��YZdeefd
��YZee�deejfd��Y�Zee�deejfd��Y�Z defd��YZ!ee�de!ejfd��Y�Z"ee�de!ejfd��Y�Z#ee�de!ejfd��Y�Z$eee�deejfd��Y�Z%eee�de%ejfd��Y�Z&eee�deejfd��Y�Z'ee�d e!ejfd!��Y�Z(d"e!ejfd#��YZ)ee�d$eejfd%��Y�Z*ee�d&eejfd'��Y�Z+ej,e
j-d(kd)�ee�d*eejfd+��Y��Z.eee�d,eejfd-��Y�Z/ee�d.eejfd/��Y�Z0ee�d0eejfd1��Y�Z1ee�d2eejfd3��Y�Z2e#e$e&e%ee e"e)e/e'e+e(e*e.e1e2e0efZ3e4d4krQee3�ndS(5i����N(tTclError(trequirestrun_unittestthave_unicodetu(t
MockTclObj(tAbstractTkTestttcl_versiontget_tk_patchleveltsimulate_mouse_click(tadd_standard_optionstnoconvtnoconv_methtAbstractWidgetTesttStandardOptionsTeststIntegerSizeTeststPixelSizeTeststsetUpModuletguitStandardTtkOptionsTestscBs#eZd�Zd�Zd�ZRS(cCs�|j�}|j|dd�d}t�d
kr>d	}n|j|dd
d|�|jdd
�}|j|dd
�dS(Ntclassts"attempt to change read-only optioniiitbetais"Attempt to change read-only optiontFooterrmsgtclass_(iiiRi(tcreatetassertEqualRtcheckInvalidParam(tselftwidgetRtwidget2((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_classs	c	Cs�|j�}|j|dddd�|j|dddd�|j|dddd�|j|dddd�|j|dddd�|j|dd�|j|dddd�dS(Ntpaddingitexpectedt0it5it6it7it8t5pt6pt7pt8pR(R#(R$(ii(R$R%(iii(R$R%R&(iiii(R$R%R&R'(R(R)R*R+((Rt
checkParam(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_paddingscCs�|j�}|j|dd�d}t|d�rQdt|d�j�}n|j|ddd|�|jdd�}|j|d	d�dS(
NtstyleRsLayout Foo not foundtdefault_orientsLayout %s.Foo not foundRRRR(RRthasattrtgetattrttitleR(RRRR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_style+s(t__name__t
__module__R R-R3(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs	
	t
WidgetTestcBs)eZdZd�Zd�Zd�ZRS(s,Tests methods available in every ttk widget.cCsRtt|�j�tj|jdddd�|_|jj�|jj�dS(NtwidthittexttText(	tsuperR6tsetUptttktButtontrootRtpacktwait_visibility(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;=s!
cCs�|jj�|j|jj|jj�d|jj�d�d�|j|jjdd�d�|jtj|jjdd�|jtj|jjdd�|jtj|jjdd�dS(Nitlabeli����Ri(
Rtupdate_idletasksRtidentifytwinfo_widthtwinfo_heighttassertRaisesttkinterRtNone(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_identifyDs
cCs�|j|jj�d
�|j|jjdg�t�|j|jjdg�d�|j|jjdg�d�|j|jjddg�d
�|j|jjddg�d�|j|jjddg�d�d�}|j|jjdg|didd6�didd6f�|jj�}|jtj|jjd	g�|jtj|jjdd	g�|j||jj��|jjddg�|j|jj�d�dS(Ns	!disabledtdisabledtactives!activec[s
||fS(N((targ1tkw((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_cbasthittheretmsgtbadstate((s	!disabled((s!activeRJ(((RK(RRtstatetinstatetTrueRFRGR(RRNt	currstate((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_widget_stateQs(""	

(R4R5t__doc__R;RIRW(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR6:s		
tAbstractToplevelTestcBseZeZRS((R4R5Rt_conv_pixels(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRYust	FrameTestc	BseZd
Zd	�ZRS(tborderwidthRtcursortheightR!treliefR.t	takefocusR7cKstj|j|�S(N(R<tFrameR>(Rtkwargs((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�s(	R\RR]R^R!R_R.R`R7(R4R5tOPTIONSR(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR[ystLabelFrameTestc
Bs)eZdZd
�Zd�Zd�ZRS(R\RR]R^tlabelanchortlabelwidgetR!R_R.R`R8t	underlineR7cKstj|j|�S(N(R<t
LabelFrameR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�scCs]|j�}|j|ddddddddd	d
ddd
dd�|j|dd�dS(NRetetentestntnetnwtstsetswtwtwntwsRs!Bad label anchor specification {}tcenter(RtcheckEnumParamR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_labelanchor�s
'cCsQ|j�}tj|jdddd�}|j|d|dd�|j�dS(NR8tMupptnametfooRfR"s.foo(RR<tLabelR>R,tdestroy(RRRA((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_labelwidget�s(
R\RR]R^ReRfR!R_R.R`R8RgR7(R4R5RcRRwR}(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRd�s		tAbstractLabelTestcBs,eZd�Zd�Zd�Zd�ZRS(cCs�tjd|jdd�}tjd|jdd�}|j|||dd�|j||ddd�|j|||fdd
�|j|||d|fdd�|j||ddd�|j||dd	d
�dS(NtmasterRytimage1timage2R"RKsimage1 active image2tspamRsimage "spam" doesn't exist(R�(R�(R�(R�RKR�(R�RKR�(RGt
PhotoImageR>R,R(RRRytimageR�((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pytcheckImageParam�scCs8|j�}|j|ddddddddd	�
dS(
NtcompoundtnoneR8R�Ruttoptbottomtlefttright(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_compound�scCs)|j�}|j|dddd�dS(NRSRKRJtnormal(RtcheckParams(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_state�scCs)|j�}|j|dddd�dS(NR7i�in���i(RR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_width�s(R4R5R�R�R�R�(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR~�s	
		t	LabelTestcBs&eZdZeZd�Zd�ZRS(tanchort
backgroundR\RR�R]tfontt
foregroundR�tjustifyR!R_RSR.R`R8ttextvariableRgR7t
wraplengthcKstj|j|�S(N(R<R{R>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�scCs#|j�}|j|dd�dS(NR�s3-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*(RR,(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt	test_font�s(R�R�R\RR�R]R�R�R�R�R!R_RSR.R`R8R�RgR7R�(R4R5RcRRZRR�(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��s	t
ButtonTestcBs)eZdZd�Zd�Zd�ZRS(RtcommandR�R]tdefaultR�R!RSR.R`R8R�RgR7cKstj|j|�S(N(R<R=R>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�scCs)|j�}|j|dddd�dS(NR�R�RKRJ(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_default�scsBg�tj|jd�fd��}|j�|j��dS(NR�cs
�jd�S(Ni(tappend((tsuccess(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt<lambda>�R(R<R=R>tinvoket
assertTrue(Rtbtn((R�s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_invoke�s!
(RR�R�R]R�R�R!RSR.R`R8R�RgR7(R4R5RcRR�R�(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��s		tCheckbuttonTestcBs2eZdZd�Zd�Zd�Zd�ZRS(RR�R�R]R�toffvaluetonvalueR!RSR.R`R8R�RgtvariableR7cKstj|j|�S(N(R<tCheckbuttonR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�scCs,|j�}|j|ddddd�dS(NR�igffffff@Rs
any string(RR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_offvalue�scCs,|j�}|j|ddddd�dS(NR�igffffff@Rs
any string(RR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_onvalue�scsg��fd�}tj|jd|�}|j|j�d
�|jtj|jj	|d�|j
�}|j|d�|j|d|jj	|d��|j��d|d<|j
�}|jt
|��|jt��d�|j|d	|jj	|d��dS(Ncs�jd�dS(Niscb test called(R�((R�(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pytcb_tests
R�t	alternateR�scb test calledR�RiR�(R�(R<R�R>RRSRFRGRttktglobalgetvarR�R�tassertFalsetstrtassertLessEqualtlen(RR�tcbtntres((R�s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��s"



(RR�R�R]R�R�R�R!RSR.R`R8R�RgR�R7(R4R5RcRR�R�R�(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��s			t	EntryTestcBszeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d�ZRS(R�RR]texportselectionR�R�tinvalidcommandR�tshowRSR.R`R�tvalidatetvalidatecommandR7txscrollcommandcCs&tt|�j�|j�|_dS(N(R:R�R;Rtentry(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;#scKstj|j|�S(N(R<tEntryR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR'scCs |j�}|j|d�dS(NR�(RtcheckCommandParam(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_invalidcommand*scCsI|j�}|j|dd�|j|dd�|j|dd�dS(NR�t*Rt (RR,(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt	test_show.scCs)|j�}|j|dddd�dS(NRSRJR�treadonly(RR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�4sc	Cs2|j�}|j|ddddddd�dS(NR�talltkeytfocustfocusintfocusoutR�(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_validate9scCs |j�}|j|d�dS(NR�(RR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_validatecommand>scCsU|j|jjd��|jtj|jjd�|jtj|jjd�dS(Nitnoindex(tassertIsBoundingBoxR�tbboxRFRGRRH(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt	test_bboxCscCs�|jj�|jj�|jj�tjdkrX|j|jjdd�d�n|j|jjdd�d�|j|jjdd�d�|j	t
j|jjdd�|j	t
j|jjdd�|j	t
j|jjdd�dS(NtdarwinittextareasCombobox.buttoni����R(R�sCombobox.button(
R�R?R@RBtsystplatformtassertInRCRRFRGRRH(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRIIs



cs#g��fd�}d|jd<d�|jd<||jd<|jj�|j��d|jd<|jj�|jt��d�||jd<d	�|jd<|jj�|jt��d�d|jd<|jj�|jt��d�t|jd<|jtj|jj�dS(
Ncs
�jt�S(N(R�RU((R�(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�]RR�R�cSstS(N(tFalse(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�`RR�R�RicSstS(N(RU(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�kR(	R�R�R�RR�RURFRGR(Rttest_invalid((R�s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_validation_options[s&










cs�g��fd�}d|jd<|jj|�df|jd<|jjdd�|jjdd�|j�ttg�|j|jj�d�dS(	NcsDd|j�kodkns3�jt�tS�jt�tS(Ntatz(tlowerR�R�RU(t	to_insert(t
validation(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�ys
"

R�R�s%SR�tendiR�(R�tregistertinsertRR�RUtget(RR�((R�s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_validationws
cCs$d�}|jj|�df|jd<|jjdd�|j|jj�t�|j|jj�d�|jjdd�|j|jj�d�|jjdd�|j|jj�t	�|j|jj�d�|jjd
�|j|jj�t�|j|jj�d
�dS(NcSs;x4|D],}d|j�ko*dknstSqWtS(NR�R�(R�R�RU(tcontenttletter((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��s
"s%PR�R�tavocadoiRta1btinvalidi((R�((
R�R�R�RR�RURStdeleteR�R�(RR�((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_revalidation�s	(R�RR]R�R�R�R�R�R�RSR.R`R�R�R�R7R�(R4R5RcR;RR�R�R�R�R�R�RIR�R�R�(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�s"											tComboboxTestcBsMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(R�RR]R�R�R�R^R�R�tpostcommandR�RSR.R`R�R�R�tvaluesR7R�cCs&tt|�j�|j�|_dS(N(R:R�R;Rtcombo(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;�scKstj|j|�S(N(R<tComboboxR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�sc	Cs2|j�}|j|ddddddd�dS(NR^idg�����LY@gfffff�Y@i����it1i(RR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_height�scCs`|jj�}|jjdd|ddd�|jjdd|ddd�|jj�dS(Ns<ButtonPress-1>txitys<ButtonRelease-1>(R�RDtevent_generateRB(RR7((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt_show_drop_down_listbox�s  cs�g�dg|jd<|jjd�fd��|jj�|jj�|jj�}|j�|jj�|jjd�|jj�|j��dS(NiR�s<<ComboboxSelected>>cs
�jt�S(N(R�RU(tevt(R�(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��Rs<Return>(	R�tbindR?R@RER�tupdateR�R�(RR^((R�s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_virtual_event�s




cs~g��fd�|jd<|jj�|jj�|j�|j��d|jd<|j�|jt��d�dS(Ncs
�jt�S(N(R�RU((R�(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��RR�Ri(R�R?R@R�R�RR�(R((R�s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_postcommand�s





c	s��fd�}�j�jdtd#kr1d$nd�|dd��j�jdddd%��j�jdd&��j�jdd'��j�jdtd(kr�d)nd�dddg�jd<�jjd�|dd��jjd�|dd��jjd�|dd��jjd�d*�jd<|dd��jjddddg��j�jd�jr�d+nd�dddg�jd<�j�jd�jr�d,nd�ddd g�jd<�j�jd�jr�d-nd!��jt	j
�jjt�jd���jt	j
�jjd�tj
�jddddg�}�j|d�jr�d.nd"�|j�dS(/Ncs6�j�jj�|��j�jj�|�dS(N(RR�R�tcurrent(tgetvaltcurrval(R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pytcheck_get_current�sR�iiRi����smon tue wed thurR"tmonttuetwedtthuri*g��Q�	@s
any stringR�itciitdit1t2s1 {} 2sa bsa	bsa
bs{a b} {a	b} {a
b}sa\tbs"a"s} {sa\\tb {"a"} \}\ \{s1 2 {}(ii((R�R�R�R(R�R�R�R(i*g��Q�	@Rs
any string(ii((iiRi(RRR(sa bsa	bsa
b(sa\tbs"a"s} {(RRR(RR�RR,tsetR�t	configuretwantobjectsRFRGRR�R<R�R>R|(RR�tcombo2((Rs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_values�sL
(




!
(R�RR]R�R�R�R^R�R�R�R�RSR.R`R�R�R�R�R7R�(
R4R5RcR;RR�R�R�R�R	(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��s						tPanedWindowTestcBsVeZdZd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Z	d�Z
RS(RR]R^torientR.R`R7cCs&tt|�j�|j�|_dS(N(R:R
R;Rtpaned(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;&scKstj|j|�S(N(R<tPanedWindowR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR*scCs�|j�}|jt|d�d�d}t�dkrDd	}n|j|dd
d|�|jdd
�}|jt|d�d
�dS(
NRtverticals"attempt to change read-only optioniiiRis"Attempt to change read-only optiont
horizontalR(iiiRi(RRR�RR(RRRR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_orient-s	cCsztj|j�}tj|�}|jtj|jj|�|j�|j�tj|j�}tj|�}|jtj|jj|�|j�|j�tj|j�}|jj|�|jtj|jj|�tj|j�}|jj|�|j	|jj
d�|jj
d��|jtj|jj
d�|j�|j�|jtj|jj
d�dS(Niii(R<R{RRFRGRtaddR|R>Rtpane(RRAtchildt
good_childtother_child((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_add8s(



(

cCs�|jtj|jjd�|jtj|jjd�|jjtj|j	��|jjd�|jtj|jjd�dS(Ni(
RFRGRRtforgetRHRR<R{R>(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_forgetTs
cCs|jtj|jjdd�|jtj|jjdd�|jtj|jjdd�tj|j�}tj|j�}tj|j�}|jtj|jjd|�|jjd|�|jjd|�|j	|jj
�t|�t|�f�|jjd|�|j	|jj
�t|�t|�f�|jjd|�|j	|jj
�t|�t|�t|�f�|jj
�}|jjd|�|j	||jj
��|jj||�|j	|jj
�t|�t|�t|�f�dS(NiR�(RFRGRRR�RHR<R{R>RtpanesR�(RRtchild2tchild3R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_insert]s*++"cCs
|jtj|jjd�tj|j�}|jj|�|j	|jjd�t
�|j|jjddd�|j
r�dnd�|j|jjdd�|j
r�dnd�|j|jjd�|jjt|���|jtj|jjddd�dS(NitweightR#t	badoptiont	somevalue(RFRGRRRR<R{R>RtassertIsInstancetdictRRHRR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt	test_pane�s.cCsi|jtj|jjd�|jtj|jjd�|jtj|jjd�tj|jdd�}|jj|dd�|jtj|jjd�tj|jdd�}|jj|�|jtj|jjd�|jj	dt
d	d
�|jj�|jjd�}|jjdd�|j||jjd��|j
|jjd�t�dS(NRiR8R�Ritbtexpandtfilltbothi�(RFRGRRtsashposRHR<R{RR?RUR@tassertNotEqualR tint(RRRtcurr_pos((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_sashpos�s
(RR]R^RR.R`R7(R4R5RcR;RRRRRR"R+(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR
s							#	tRadiobuttonTestcBs)eZdZd�Zd�Zd�ZRS(RR�R�R]R�R!RSR.R`R8R�RgtvalueR�R7cKstj|j|�S(N(R<tRadiobuttonR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�scCs,|j�}|j|ddddd�dS(NR-igffffff@Rs
any string(RR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_value�scs�g��fd�}tj|j�}tj|jd|d|dd�}tj|jd|d|dd�}|jr�d�}nt}|j�}|j|d�|j||d�|j	��|j|j	�||j
j|d���|j��d	|d<|j�}|jt
|�d	�|jt��d�|j||d�|j	��|j|j	�||j
j|d���|jt
|d�t
|d��dS(
Ncs�jd�dS(Niscb test called(R�((R�(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��s
R�R�R-iicSs|S(N((R�((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��Rscb test calledR(RGtIntVarR>R<R.RR)R�RR�R�R�R�R�R�R�(RR�tmyvarR�tcbtn2tconvR�((R�s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��s0	 

 (RR�R�R]R�R!RSR.R`R8R�RgR-R�R7(R4R5RcRR/R�(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR,�s		tMenubuttonTestcBs)eZdZd�Zd�Zd�ZRS(RR�R]t	directionR�tmenuR!RSR.R`R8R�RgR7cKstj|j|�S(N(R<t
MenubuttonR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�scCs/|j�}|j|dddddd�dS(NR5tabovetbelowR�R�tflush(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_direction�scCsH|j�}tj|dd�}|j|d|dt�|j�dS(NRyR6R3(RRGtMenuR,R�R|(RRR6((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt	test_menu�s(RR�R]R5R�R6R!RSR.R`R8R�RgR7(R4R5RcRR;R=(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR4�s		t	ScaleTestcBskeZdZeZdZd�Zd
�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d�ZRS(RR�R]tfromtlengthRR.R`ttoR-R�RcCs@tt|�j�|j�|_|jj�|jj�dS(N(R:R>R;RtscaleR?R�(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;�s
cKstj|j|�S(N(R<tScaleR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRscCs/|j�}|j|dddddt�dS(NR?idg������-@g333333.@R3(RtcheckFloatParamR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt	test_fromscCs,|j�}|j|ddddd�dS(NR@i�gffffff`@g33333�`@t5i(RtcheckPixelsParam(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_lengthsc	Cs2|j�}|j|ddddddt�dS(NRAi,g������-@g333333.@i����R3(RRDR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_tosc	Cs2|j�}|j|ddddddt�dS(NR-i,g������-@g333333.@i����R3(RRDR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR/scs�dddg�|jjd�fd��}d|jd<d|jd<d|jd<|j��dddg�|jjdd	dd
�|jjdddd�|jjdd�|j��dS(
Nis<<RangeChanged>>cs
�j�S(N(tpop(R�(tfailure(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�Ri
R?tfrom_iRAiiii����(RBR�R�R(Rtfuncid((RKs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_custom_events



cCs|jrd�}nt}|jj�}|j|jj|d�|jd�|j||jjdd��||jd��|j|jj�|jd�d|jd<|j|jj�|jd�|jtj|jjdd�|jtj|jjdd�dS(NcSs|S(N((R�((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�(RiRAR?R-iR(	RtfloatRBRDRR�RFRGR(RR3tscale_width((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_get&s	&2 
 cCs�|jrd�}nt}||jd�}|d}|jj|�|j||jj��|�||jd�}|jj|d�|j||jj��|�tj|j�}||jd<|j|d�|j||jj��|j��|j||jj��|d�~|d|jd<|j||jj��|d�|j||jj��||jd��|j||jjd	d	��|�|j||jj|jj	�d	��|�|j
tj|jjd�dS(
NcSs|S(N((R�((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�:RRAi
R?iR�iR-i(
RRORBRRR�RGt	DoubleVarR>RDRFRRH(RR3tmaxtnew_maxtmintvar((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_set8s,	

%##,%.(RR�R]R?R@RR.R`RAR-R�(R4R5RcRRZR/R;RRERHRIR/RNRQRW(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR>�s								tProgressbarTestcBsPeZdZeZdZd�Zd
�Zd�Zd�Z	d�Z
d�ZRS(RR]RR@tmodetmaximumtphaseR.R`R-R�RcKstj|j|�S(N(R<tProgressbarR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRfscCs)|j�}|j|dddd�dS(NR@gfffffY@g�����YL@t2i(RRG(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRHisc	Cs2|j�}|j|ddddddt�dS(NRZgfffff�b@g�����lS@ii����R3(RRDR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_maximummscCs&|j�}|j|ddd�dS(NRYtdeterminatet
indeterminate(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt	test_modeqscCsdS(N((R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_phaseusc	Cs2|j�}|j|ddddddt�dS(NR-gfffff�b@g�����lS@ii����R3(RRDR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR/ys(RR]RR@RYRZR[R.R`R-R�(R4R5RcRRZR/RRHR^RaRbR/(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRX\s					R�s"ttk.Scrollbar is special on MacOSXt
ScrollbarTestcBseZdZdZd�ZRS(	RR�R]RR.R`RcKstj|j|�S(N(R<t	ScrollbarR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�s(RR�R]RR.R`(R4R5RcR/R(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRcstNotebookTestcBsqeZdZd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Z	d�Z
d�Zd�Zd�Z
RS(RR]R^R!R.R`R7cCs�tt|�j�|jdd�|_tj|j�|_tj|j�|_	|jj
|jdd�|jj
|j	dd�dS(NR!iR8R�R#(R:ReR;RtnbR<R{R>tchild1RR(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;�scKstj|j|�S(N(R<tNotebookR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�scCs�|jjd�|jj|j�|jtj|jj|j�|j	|jj
d�d�|jj|j�|j	|jj
d�d�|jj|j�|j
|jjd��|jj|jdd�|jj�|jj�tjdkrd}nd	}|j	|jj|�|jjd��xhtd
dd
�D]G}y*|jjd|dd�dkrtPnWqEtjk
r�qEXqEW|jd
�dS(NiR�iR�R8R�R�s@20,5s@5,5iids@%d, 5sTab with text 'a' not found(RfRthideRRFRGRttabRgRtindexRtselectR�R?R@R�R�trangeRHtfail(Rttb_idxti((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_tab_identifiers�s,

	("cCs�|jtj|jjd�|jtj|jjd�|jtj|jjd�|jtj|jjd�|jtj|jjtj|j	�dd�|jj
�}|jj|j�|jj|j�|j|jj
�|�tj|j	�}|jj|dd�|jj
�}|jj
d�}|jj
|j�}|jj|j�|jj|j�|j|jj
�|�|j|jj
|j�|�|jt|j�|jj
�|�|j|jj
d�|d�dS(	Ni����ROtunknowntoptionR8RR�i(RFRGRRfRiRHRR<R{R>ttabsRgRRkRR�(RRtRtcurrtchild2_index((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_add_and_hidden�s*'&cCs+|jtj|jjd�|jtj|jjd�|jtj|jjd�|jj�}|jj|j�}|jj|j�|j	t
|j�|jj��|jt|�dt|jj���|jj
|j�|j|jj|j�d�|j||jj|j��dS(Ni����ROi(RFRGRRfRRHRtRkRgtassertNotInR�RR�RR((RRttchild1_index((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�s")cCs�|jtj|jjd�|jtj|jjd�|j|jjd�t�|j|jj|j	�d�|j|jj|j
�d�|j|jjd�d�dS(Ni����R�iii(RFRGRRfRkRHR R)RRgR(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_index�scCs�|jj�}|jjd|d�|j|jj�|d|df�|jj|j|j�|j|jj�|�|jjd|j�|j|jj�|d|df�|jjdd�|j|jj�|�|jtj|jjd|d�|jtj|jjd|d�t	j
|j�}|jjd|�|j|jj�|dt|�|df�|jj
|�|j|jj�|�|jj|j|�|j|jj�t|�f|�|jj
|�|jtj|jjd|�|jtj|jjd|�|jtj|jjdd�|jtj|jjdd�|jtj|jjdd�dS(NiiR�ii����(RfRtR�RRgRRFRGRR<R{R>R�RRH(RRtR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�s0''##0&cs�|jj�|jj�g�g�|jjd�fd��|jjd�fd��|j|jj�t|j��|jj|j�|j	��|j|jj�t|j��|jj
�|j	��dS(Ns<Unmap>cs
�jt�S(N(R�RU(R�(R�(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�Rs<<NotebookTabChanged>>cs
�jt�S(N(R�RU(R�(ttab_changed(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�R(RfR?R@RgR�RRlR�RR�R�(R((R�R{s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_selects

"
"
cCs|jtj|jjd�|jtj|jjd�|jtj|jjd�|j|jj|j�t�|j	|jj|jdd�d�|j	|jj|jd�d�|jj|jdd�|j	|jj|jdd�d�|j	|jj|jd�d�dS(Ni����tnotabR8R�tabc(
RFRGRRfRjRHR RgR!R(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_tab(s%"%cCsb|jt|jj��d�|jj|j�|jj|j�|j|jj�d�dS(Ni((RR�RfRtRRgR(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt	test_tabs6scCs�|jj�|jj�|jjd�t|jdd�|jj�|jjd�|j|jj�t|j	��|jj�|jjd�|j|jj�t|j
��|jj�|jjd�|j|jj�t|j	��|jj|j
dddd�|jj�|jj�t|jdd�t
jdkrh|jjd	�n|jjd
�|j|jj�t|j
��dS(Niis
<Control-Tab>s<Shift-Control-Tab>R8R�RgR�s
<Option-a>s<Alt-a>(RfR?R@RlR	tfocus_forceR�RR�RRgRjtenable_traversalR�R�(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_traversal?s*


"
"
"

(RR]R^R!R.R`R7(R4R5RcR;RRqRwRRzRR|RR�R�(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRe�s						
	!				tTreeviewTestcBs�eZd#Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd �Zd!�Zd"�ZRS($RtcolumnsR]tdisplaycolumnsR^R!t
selectmodeR�R.R`R�tyscrollcommandcCs,tt|�j�|jdd�|_dS(NR!i(R:R�R;Rttv(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;cscKstj|j|�S(N(R<tTreeviewR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRgscCsa|j�}|j|dddd
�|j|dd�|j|dtdkrVd
nd	�dS(NR�sa b cR"R�R#RiiR(R�R#R(R�R#R(ii((RR,R(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_columnsjs
cCs�|j�}d|d<|j|dddd�|j|dd�|j|dddd�|j|dd�|j|ddd
d�|j|ddd
d�|j|ddd
d�dS(NR�R#RR�R�sb a cR"s#alliiiRRsInvalid column index disColumn index 3 out of boundsi����sColumn index -2 out of bounds(R�R#R(R#R�R(R#R�R(s#all(iii(R�R#R(iii(ii����(RR,R(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_displaycolumnsqs
c	CsN|j�}|j|ddddddt�|j|ddddt�dS(	NR^idi����it3cR3g�����LY@gfffff�Y@(RRGR�R(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��s"cCs)|j�}|j|dddd�dS(NR�R�tbrowsetextended(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_selectmode�scCs�|j�}|j|dddd�|j|dd�|j|dd�|j|dddd	�|j|dddd
�dS(NR�s
tree headingsR"ttreetheadings(R�R�(R�R�(R�R�(R�(R�(RR,(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��scCsW|jj�|j|jjd�d�|jj�|jj�|jjdd�}|jj�}|j|�|jj|d�}|j	|�dg|jd<|jj
ddd�|jj|dd�}|jj
ddd�}|jst
|�}n|j|d|d|�|jj|d�}|j|jj|�d�dS(	NRR�ittestR�R7i2s#0(R�R?RR�R@R�R�tget_childrenR�R�tcolumnRHRR)(Rtitem_idtchildrenR�tbbox_column0t
root_widthRg((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��s$




	cCs>|j|jj�d�|jjdd�}|j|jj�t�|j|jj�d|�|jjdd�}|jjdd�}|jj|||�|j|jj|�||f�|jtj	|jj||�|jj|�|j|jj|�d�|jjd�|j|jj�d�dS(NRR�i((((
RR�R�R�R ttupletset_childrenRFRGR(RR�RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_children�s"cCsi|j|jjd�t�|jrJ|j|jjddd�t�n|jjddd�|j|jjdd�|jr�dnd�|j|jjddd�|jr�dnd�|jt	j
|jjddd�|jt	j
|jjd�idd	6id
d6id
d6id
d6id
d
6g}x-|D]%}|jt	j
|jjd|�q<WdS(Ns#0R7i
t10tidtXR�s
some valuetunknown_optiontwrongtstretchR�tminwidth(R R�R�R!RRHR)RRFRGR(Rtinvalid_kwsRM((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_column�s	%"$
cCs?|jtj|jjd�|jjdd�}|jj|d�}|j|jj�|f�|j|jj|�|f�|jj|�|j|jj��|jtj|jj	|dd�|jjdd�}|jjdd�}|j|jj�||f�|jj||�|j|jj��dS(Ns#0RR�(
RFRGRR�R�R�RR�R�treattach(RR�titem2titem1((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_delete�scCs0|jjdd�}|jj|d�}|jj�}|jj�|j||jj��|j|jj�|f�|j|jj|�|f�|jj|�|j|jj��|jj|dd�|j|jj�|f�|j|jj|�|f�|jj|dd�|j|jj�||f�|j|jj|�d�|jt	j
|jjddd�|jt	j
|jjd�|jt	j
|jj|dd�|jt	j
|jj|dd�|jj||�|j|jj�d�|j|jj|�d�dS(	NRR�tnonexistenttotherparentR�((((R�R�R�tdetachRR�R�tmoveRFRGR(RR�R�tprev((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_detach_reattach�s4
cCst|j|jjd�t�|j|jjd�t�|j|jji�t�|jtj|jjd�dS(Nt	somethingR(	RR�texistsR�RURFRGRRH(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_exists'scCs�|j|jj�d�|jjdd�}|jj|�|j|jj�|�|jj|�|j|jj�d�|jtj|jjd�dS(NRR�RO(RR�R�R�R�RFRGR(RR�((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_focus2scCs�|j|jjd�t�|jjddd�|j|jjdd�d�|j|jjddd�d�|jtj|jjddd�|jtj|jjddd�dS(Ns#0R8ROR�R�i(	R R�theadingR!RRHRFRGR(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_headingAs"cs�fd�}g��jj��jj��jjdd�fd���jjddd��jj�|dd��s��jd�ng��jjj}�jjddt	�jjddd����j|�jjj�|dd��s�jd�ndS(	Ncs$t�j||��jj�dS(N(R	R�R�(R�R�(R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pytsimulate_heading_clickRss#0R�cs
�jt�S(N(R�RU((R�(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�ZRR7idis>The command associated to the treeview heading wasn't invoked.(R�R?R@R�R�R�RnRt_tclCommandsR�RHR(RR�tcommands((RR�s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_heading_callbackQs"



.
cCs�|jtj|jjd�|j|jjd�d�|jjdd�}|jjdd�}|jj|d�}|jj|d�}|j|jj|�d�|j|jj|�d�|j|jj|�d�|j|jj|�d�|jj|dd�|j|jj|�d�|j|jj|�d�|jj|�|j|jj|�d�|jj|�|j|jj|�d�|jj	|�|jtj|jj|�dS(NtwhatRiR�i(
RFRGRR�RkRR�R�R�R�(RR�R�tc1tc2((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRzss&cCs�|jtj|jjdd�|jtj|jjdddd�|jtj|jjdddd�|j|jj|jjdddt���|j|jj|jjdddt���|jtj|jjdd�|jjddd�}|j	|d�|jtj|jjddd�|jtj|jjddt
d��d}|jjddd	|f�}|j	|jj|d	�|jr�|fn|�|j	|jj|d	d�|jr�|fn|�|jj|d	|jj|jj|d	d���|j	|jj|d	d�|jr@|fn|�|j|jj|�t�|jj|d	d�|j|jj|d	d��|jjddd
dd|g�}|j	|jj|d
d�|jr�d
d|fnd|�|jj|d
g�|j|jj|d
d��|jj|d
d�|j	|jj|d
d�|jrodnd�|jjddd	dd||ff�}|j	|jj|d	d�|jr�dd||ffn
d||f�|j	|jj|jjdddd�dd�d�|j	|jj|jjddd|�dd�|�|jjddd�}|j	|d�|jjddd�}|j	|d�|jtj|jjddt�|jtj|jjddd�dS(NR�R�Rtopentpleasetmiddles
first-itemuábaR�ttagsiiRRs1 2 %ss1 2sa b cs%s %ss{a b c} {%s %s}R8s
Label hereiR#gs0.0(ii(RR(RFRGRR�R�R�R�RUR�RRtitemRRHR>t	splitlistR R!(RtitemidR-R�((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_insert_item�sh..
4$!!"cCs�|jtj|jjd�|jtj|jjd�|jtj|jjd�|jtj|jjd�|jjdd�}|jjdd�}|jj|d�}|jj|d�}|jj|d�}|j	|jj
�d
�|jj||f�|j	|jj
�||f�|jj|�|j	|jj
�|f�|jj||f�|j	|jj
�|||f�|jj|�|j	|jj
�||||f�|jj||f�|j	|jj
�|||f�|jj|�|j	|jj
�||f�|jj||f�|j	|jj
�||f�|jj|�|j	|jj
�|f�|jjdddd�|jjd�|j	|jj
�d�|jjdddd�|jjd�|j	|jj
�d�trl|jjdddtd��|jjtd��|j	|jj
�td�f�n|jjdddd�|jjd�|j	|jj
�tr�td	�ndf�dS(
NR�RR�R�swith spacess{braces
unicode\u20acsbytes€sbytes\u20ac((swith spaces(s{brace(
RFRGRR�t
selection_sett
selection_addtselection_removetselection_toggleR�Rt	selectionRR(RR�R�R�R�tc3((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_selection�sR"%"%cCsPddg|jd<|jjdddddg�}|j|jj|�idd6dd6�|jj|dd�|j|jj|dd�|jr�dnd	�dg|jd<|j|jj|�idd6�|jj|dd�|j|jj|d
d�d�|j|jj|dd�|jr:dnd�|jj|dd�|j|jj|d�|jr~dnd
�|j|jj|dd�|jr�dnd�|j|jj|�|jr�idd6n
id
d6�|jtj	|jj|d�|jtj	|jj|dd�|jtj	|jjd�dS(NtAtBR�RR�R�R�R#sa aR�sb ai{t123s123 atnotme(R�R�(R#R�(i{R�(
R�R�RRR�RHRRFRGR(RR�((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRWs,!*#"$"c	s�g�|jjddddg�}|jjddddg�}|jjdd�fd��|jjdd�fd��|jj�|jj�|jj�t�}t�}xqtd	d
d�D]]}t|�dkr�Pn|jj	|�}|r�||kr�|j
|�|j
|�q�q�W|jt|�d�x!|D]}t|jd	|�qJW|jt��d
�xAt
�ddd��ddd��D]}|j|d�q�WdS(NRR�R�tcalls<ButtonPress-1>cs
�jd�S(Ni(R�(R�(tevents(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�;Rs<ButtonRelease-1>cs
�jd�S(Ni(R�(R�(R�(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�=Riidi
iii(ii(R�R�ttag_bindR?R@R�RRmR�tidentify_rowRRR	tzip(	RR�R�tpos_ytfoundRpR�R�R�((R�s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_tag_bind6s2


		

0cCs�|jt|jj�|jtj|jjddd�|jjddd�|jt|jjdd��d�|jt|jjddd��d�|j	|jjd�t
�dS(NR�tskytblueR�(RFt	TypeErrorR�t
tag_configureRGRRR�RHR R!(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_tag_configureXs
!cCs�|jjddddddg�}|jjddddddg�}|jt|jj�|jt|jjdd	�|j|jjd|��|j|jjd|��|j|jjd|��|j|jjd|��|j|jjd
|��|j|jjd
|��|j|jjd�|f�|j|jjd�|f�|j|jjd
�d�dS(NRR�R8sItem 1R�ttag1sItem 2ttag2snon-existingttag3((	R�R�RFR�ttag_hasRR�R�R(RR�R�((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_tag_hasds$$(RR�R]R�R^R!R�R�R.R`R�R�(R4R5RcR;RR�R�R�R�R�R�R�R�R�R�R�R�R�R�RzR�R�RWR�R�R�(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�[s4													*				"		M	6	!	"	t
SeparatorTestcBseZdZdZd�ZRS(RR]RR.R`RcKstj|j|�S(N(R<t	SeparatorR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR|s(RR]RR.R`(R4R5RcR/R(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�tstSizegripTestcBseZdZd�ZRS(RR]R.R`cKstj|j|�S(N(R<tSizegripR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�s(RR]R.R`(R4R5RcR(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��st__main__(5tunittesttTkinterRGRR<ttest.test_supportRRRRR�ttest_functionsRtsupportRRRR	twidget_testsR
RRR
RRRRRtTestCaseR6RYR[RdR~R�R�R�R�R�R
R,R4R>RXtskipIfR�RcReR�R�R�t	tests_guiR4(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt<module>sr"":
';0�|�3j"
���	test_ttk/test_style.pyo000064400000006341150351526610011345 0ustar00�
zfc@s�ddlZddlZddlZddlmZmZddlmZed�deej	fd��YZ
e
fZedkr�ee�ndS(i����N(trequirestrun_unittest(tAbstractTkTesttguit	StyleTestcBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs,tt|�j�tj|j�|_dS(N(tsuperRtsetUptttktStyletroottstyle(tself((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyRscCsU|j}|jddd�|j|jdd�d�|j|jd�t�dS(NtTButtont
backgroundtyellow(R
t	configuretassertEqualtassertIsInstancetdict(RR
((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyttest_configures
	cCsm|j}|jdddg�|j|jdd�|jrFdgndg�|j|jd�t�dS(	NRR
tactivetbluesactive background(RR
R(RR
R(sactive backgroundR(R
tmapRtwantobjectsRR(RR
((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyttest_maps	
cCs�|j}|jddd�|jddd	g�|j|jdd�d�|j|jddddg�d�|j|jdddd�d�dS(
NRR
RRRtoptionnotdefinedtdefaulttiknewit(RR
R(R
RRRtlookup(RR
((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyttest_lookup!s	cCs�|j}|jtj|jd�|jd�}|jdd�|j|jd�didd6fg�|jd|�|j|jd�|�|j|jd�t�|jtj|jddid	d
6fg�dS(Nt
NotALayouttTreeviewttnulltnswetstickyRtnamet
inexistenttoption(R
tassertRaisesttkintertTclErrortlayoutRRtlist(RR
ttv_style((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyttest_layout-s	cCs�|jtj|jjd�|jj�}d}xA|jj�D],}||krA|}|jj|�PqAqAWdS|j||k�|j||jj�k�|jj|�dS(Ntnonexistingname(R'R(R)R
t	theme_usetNonettheme_namestassertFalse(Rt
curr_themet	new_themettheme((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyttest_theme_useDs(t__name__t
__module__RRRRR-R6(((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyR	s						t__main__(
tunittesttTkinterR(Rttest.test_supportRRttest_ttk.supportRtTestCaseRt	tests_guiR7(((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyt<module>s
P	test_ttk/__init__.pyc000064400000000214150351526610010662 0ustar00�
zfc@sdS(N((((s5/usr/lib64/python2.7/lib-tk/test/test_ttk/__init__.pyt<module>ttest_ttk/test_style.pyc000064400000006341150351526610011331 0ustar00�
zfc@s�ddlZddlZddlZddlmZmZddlmZed�deej	fd��YZ
e
fZedkr�ee�ndS(i����N(trequirestrun_unittest(tAbstractTkTesttguit	StyleTestcBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs,tt|�j�tj|j�|_dS(N(tsuperRtsetUptttktStyletroottstyle(tself((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyRscCsU|j}|jddd�|j|jdd�d�|j|jd�t�dS(NtTButtont
backgroundtyellow(R
t	configuretassertEqualtassertIsInstancetdict(RR
((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyttest_configures
	cCsm|j}|jdddg�|j|jdd�|jrFdgndg�|j|jd�t�dS(	NRR
tactivetbluesactive background(RR
R(RR
R(sactive backgroundR(R
tmapRtwantobjectsRR(RR
((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyttest_maps	
cCs�|j}|jddd�|jddd	g�|j|jdd�d�|j|jddddg�d�|j|jdddd�d�dS(
NRR
RRRtoptionnotdefinedtdefaulttiknewit(RR
R(R
RRRtlookup(RR
((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyttest_lookup!s	cCs�|j}|jtj|jd�|jd�}|jdd�|j|jd�didd6fg�|jd|�|j|jd�|�|j|jd�t�|jtj|jddid	d
6fg�dS(Nt
NotALayouttTreeviewttnulltnswetstickyRtnamet
inexistenttoption(R
tassertRaisesttkintertTclErrortlayoutRRtlist(RR
ttv_style((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyttest_layout-s	cCs�|jtj|jjd�|jj�}d}xA|jj�D],}||krA|}|jj|�PqAqAWdS|j||k�|j||jj�k�|jj|�dS(Ntnonexistingname(R'R(R)R
t	theme_usetNonettheme_namestassertFalse(Rt
curr_themet	new_themettheme((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyttest_theme_useDs(t__name__t
__module__RRRRR-R6(((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyR	s						t__main__(
tunittesttTkinterR(Rttest.test_supportRRttest_ttk.supportRtTestCaseRt	tests_guiR7(((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyt<module>s
P	test_ttk/test_widgets.pyc000064400000170617150351526610011647 0ustar00�
zfc@sUddlZddlZddlmZddlZddlmZmZmZm	Z	ddl
Z
ddlmZddl
mZmZmZmZddlmZmZmZmZmZmZmZmZed�defd	��YZd
eejfd��YZdeefd
��YZee�deejfd��Y�Zee�deejfd��Y�Z defd��YZ!ee�de!ejfd��Y�Z"ee�de!ejfd��Y�Z#ee�de!ejfd��Y�Z$eee�deejfd��Y�Z%eee�de%ejfd��Y�Z&eee�deejfd��Y�Z'ee�d e!ejfd!��Y�Z(d"e!ejfd#��YZ)ee�d$eejfd%��Y�Z*ee�d&eejfd'��Y�Z+ej,e
j-d(kd)�ee�d*eejfd+��Y��Z.eee�d,eejfd-��Y�Z/ee�d.eejfd/��Y�Z0ee�d0eejfd1��Y�Z1ee�d2eejfd3��Y�Z2e#e$e&e%ee e"e)e/e'e+e(e*e.e1e2e0efZ3e4d4krQee3�ndS(5i����N(tTclError(trequirestrun_unittestthave_unicodetu(t
MockTclObj(tAbstractTkTestttcl_versiontget_tk_patchleveltsimulate_mouse_click(tadd_standard_optionstnoconvtnoconv_methtAbstractWidgetTesttStandardOptionsTeststIntegerSizeTeststPixelSizeTeststsetUpModuletguitStandardTtkOptionsTestscBs#eZd�Zd�Zd�ZRS(cCs�|j�}|j|dd�d}t�d
kr>d	}n|j|dd
d|�|jdd
�}|j|dd
�dS(Ntclassts"attempt to change read-only optioniiitbetais"Attempt to change read-only optiontFooterrmsgtclass_(iiiRi(tcreatetassertEqualRtcheckInvalidParam(tselftwidgetRtwidget2((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_classs	c	Cs�|j�}|j|dddd�|j|dddd�|j|dddd�|j|dddd�|j|dddd�|j|dd�|j|dddd�dS(Ntpaddingitexpectedt0it5it6it7it8t5pt6pt7pt8pR(R#(R$(ii(R$R%(iii(R$R%R&(iiii(R$R%R&R'(R(R)R*R+((Rt
checkParam(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_paddingscCs�|j�}|j|dd�d}t|d�rQdt|d�j�}n|j|ddd|�|jdd�}|j|d	d�dS(
NtstyleRsLayout Foo not foundtdefault_orientsLayout %s.Foo not foundRRRR(RRthasattrtgetattrttitleR(RRRR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_style+s(t__name__t
__module__R R-R3(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs	
	t
WidgetTestcBs)eZdZd�Zd�Zd�ZRS(s,Tests methods available in every ttk widget.cCsRtt|�j�tj|jdddd�|_|jj�|jj�dS(NtwidthittexttText(	tsuperR6tsetUptttktButtontrootRtpacktwait_visibility(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;=s!
cCs�|jj�|j|jj|jj�d|jj�d�d�|j|jjdd�d�|jtj|jjdd�|jtj|jjdd�|jtj|jjdd�dS(Nitlabeli����Ri(
Rtupdate_idletasksRtidentifytwinfo_widthtwinfo_heighttassertRaisesttkinterRtNone(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_identifyDs
cCs�|j|jj�d
�|j|jjdg�t�|j|jjdg�d�|j|jjdg�d�|j|jjddg�d
�|j|jjddg�d�|j|jjddg�d�d�}|j|jjdg|didd6�didd6f�|jj�}|jtj|jjd	g�|jtj|jjdd	g�|j||jj��|jjddg�|j|jj�d�dS(Ns	!disabledtdisabledtactives!activec[s
||fS(N((targ1tkw((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_cbasthittheretmsgtbadstate((s	!disabled((s!activeRJ(((RK(RRtstatetinstatetTrueRFRGR(RRNt	currstate((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_widget_stateQs(""	

(R4R5t__doc__R;RIRW(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR6:s		
tAbstractToplevelTestcBseZeZRS((R4R5Rt_conv_pixels(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRYust	FrameTestc	BseZd
Zd	�ZRS(tborderwidthRtcursortheightR!treliefR.t	takefocusR7cKstj|j|�S(N(R<tFrameR>(Rtkwargs((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�s(	R\RR]R^R!R_R.R`R7(R4R5tOPTIONSR(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR[ystLabelFrameTestc
Bs)eZdZd
�Zd�Zd�ZRS(R\RR]R^tlabelanchortlabelwidgetR!R_R.R`R8t	underlineR7cKstj|j|�S(N(R<t
LabelFrameR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�scCs]|j�}|j|ddddddddd	d
ddd
dd�|j|dd�dS(NRetetentestntnetnwtstsetswtwtwntwsRs!Bad label anchor specification {}tcenter(RtcheckEnumParamR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_labelanchor�s
'cCsQ|j�}tj|jdddd�}|j|d|dd�|j�dS(NR8tMupptnametfooRfR"s.foo(RR<tLabelR>R,tdestroy(RRRA((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_labelwidget�s(
R\RR]R^ReRfR!R_R.R`R8RgR7(R4R5RcRRwR}(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRd�s		tAbstractLabelTestcBs,eZd�Zd�Zd�Zd�ZRS(cCs�tjd|jdd�}tjd|jdd�}|j|||dd�|j||ddd�|j|||fdd
�|j|||d|fdd�|j||ddd�|j||dd	d
�dS(NtmasterRytimage1timage2R"RKsimage1 active image2tspamRsimage "spam" doesn't exist(R�(R�(R�(R�RKR�(R�RKR�(RGt
PhotoImageR>R,R(RRRytimageR�((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pytcheckImageParam�scCs8|j�}|j|ddddddddd	�
dS(
NtcompoundtnoneR8R�Ruttoptbottomtlefttright(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_compound�scCs)|j�}|j|dddd�dS(NRSRKRJtnormal(RtcheckParams(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_state�scCs)|j�}|j|dddd�dS(NR7i�in���i(RR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_width�s(R4R5R�R�R�R�(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR~�s	
		t	LabelTestcBs&eZdZeZd�Zd�ZRS(tanchort
backgroundR\RR�R]tfontt
foregroundR�tjustifyR!R_RSR.R`R8ttextvariableRgR7t
wraplengthcKstj|j|�S(N(R<R{R>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�scCs#|j�}|j|dd�dS(NR�s3-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*(RR,(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt	test_font�s(R�R�R\RR�R]R�R�R�R�R!R_RSR.R`R8R�RgR7R�(R4R5RcRRZRR�(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��s	t
ButtonTestcBs)eZdZd�Zd�Zd�ZRS(RtcommandR�R]tdefaultR�R!RSR.R`R8R�RgR7cKstj|j|�S(N(R<R=R>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�scCs)|j�}|j|dddd�dS(NR�R�RKRJ(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_default�scsBg�tj|jd�fd��}|j�|j��dS(NR�cs
�jd�S(Ni(tappend((tsuccess(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt<lambda>�R(R<R=R>tinvoket
assertTrue(Rtbtn((R�s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_invoke�s!
(RR�R�R]R�R�R!RSR.R`R8R�RgR7(R4R5RcRR�R�(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��s		tCheckbuttonTestcBs2eZdZd�Zd�Zd�Zd�ZRS(RR�R�R]R�toffvaluetonvalueR!RSR.R`R8R�RgtvariableR7cKstj|j|�S(N(R<tCheckbuttonR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�scCs,|j�}|j|ddddd�dS(NR�igffffff@Rs
any string(RR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_offvalue�scCs,|j�}|j|ddddd�dS(NR�igffffff@Rs
any string(RR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_onvalue�scsg��fd�}tj|jd|�}|j|j�d
�|jtj|jj	|d�|j
�}|j|d�|j|d|jj	|d��|j��d|d<|j
�}|jt
|��|jt��d�|j|d	|jj	|d��dS(Ncs�jd�dS(Niscb test called(R�((R�(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pytcb_tests
R�t	alternateR�scb test calledR�RiR�(R�(R<R�R>RRSRFRGRttktglobalgetvarR�R�tassertFalsetstrtassertLessEqualtlen(RR�tcbtntres((R�s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��s"



(RR�R�R]R�R�R�R!RSR.R`R8R�RgR�R7(R4R5RcRR�R�R�(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��s			t	EntryTestcBszeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d�ZRS(R�RR]texportselectionR�R�tinvalidcommandR�tshowRSR.R`R�tvalidatetvalidatecommandR7txscrollcommandcCs&tt|�j�|j�|_dS(N(R:R�R;Rtentry(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;#scKstj|j|�S(N(R<tEntryR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR'scCs |j�}|j|d�dS(NR�(RtcheckCommandParam(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_invalidcommand*scCsI|j�}|j|dd�|j|dd�|j|dd�dS(NR�t*Rt (RR,(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt	test_show.scCs)|j�}|j|dddd�dS(NRSRJR�treadonly(RR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�4sc	Cs2|j�}|j|ddddddd�dS(NR�talltkeytfocustfocusintfocusoutR�(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_validate9scCs |j�}|j|d�dS(NR�(RR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_validatecommand>scCsU|j|jjd��|jtj|jjd�|jtj|jjd�dS(Nitnoindex(tassertIsBoundingBoxR�tbboxRFRGRRH(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt	test_bboxCscCs�|jj�|jj�|jj�tjdkrX|j|jjdd�d�n|j|jjdd�d�|j|jjdd�d�|j	t
j|jjdd�|j	t
j|jjdd�|j	t
j|jjdd�dS(NtdarwinittextareasCombobox.buttoni����R(R�sCombobox.button(
R�R?R@RBtsystplatformtassertInRCRRFRGRRH(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRIIs



cs#g��fd�}d|jd<d�|jd<||jd<|jj�|j��d|jd<|jj�|jt��d�||jd<d	�|jd<|jj�|jt��d�d|jd<|jj�|jt��d�t|jd<|jtj|jj�dS(
Ncs
�jt�S(N(R�RU((R�(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�]RR�R�cSstS(N(tFalse(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�`RR�R�RicSstS(N(RU(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�kR(	R�R�R�RR�RURFRGR(Rttest_invalid((R�s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_validation_options[s&










cs�g��fd�}d|jd<|jj|�df|jd<|jjdd�|jjdd�|j�ttg�|j|jj�d�dS(	NcsDd|j�kodkns3�jt�tS�jt�tS(Ntatz(tlowerR�R�RU(t	to_insert(t
validation(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�ys
"

R�R�s%SR�tendiR�(R�tregistertinsertRR�RUtget(RR�((R�s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_validationws
cCs$d�}|jj|�df|jd<|jjdd�|j|jj�t�|j|jj�d�|jjdd�|j|jj�d�|jjdd�|j|jj�t	�|j|jj�d�|jjd
�|j|jj�t�|j|jj�d
�dS(NcSs;x4|D],}d|j�ko*dknstSqWtS(NR�R�(R�R�RU(tcontenttletter((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��s
"s%PR�R�tavocadoiRta1btinvalidi((R�((
R�R�R�RR�RURStdeleteR�R�(RR�((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_revalidation�s	(R�RR]R�R�R�R�R�R�RSR.R`R�R�R�R7R�(R4R5RcR;RR�R�R�R�R�R�RIR�R�R�(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�s"											tComboboxTestcBsMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(R�RR]R�R�R�R^R�R�tpostcommandR�RSR.R`R�R�R�tvaluesR7R�cCs&tt|�j�|j�|_dS(N(R:R�R;Rtcombo(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;�scKstj|j|�S(N(R<tComboboxR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�sc	Cs2|j�}|j|ddddddd�dS(NR^idg�����LY@gfffff�Y@i����it1i(RR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_height�scCs`|jj�}|jjdd|ddd�|jjdd|ddd�|jj�dS(Ns<ButtonPress-1>txitys<ButtonRelease-1>(R�RDtevent_generateRB(RR7((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt_show_drop_down_listbox�s  cs�g�dg|jd<|jjd�fd��|jj�|jj�|jj�}|j�|jj�|jjd�|jj�|j��dS(NiR�s<<ComboboxSelected>>cs
�jt�S(N(R�RU(tevt(R�(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��Rs<Return>(	R�tbindR?R@RER�tupdateR�R�(RR^((R�s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_virtual_event�s




cs~g��fd�|jd<|jj�|jj�|j�|j��d|jd<|j�|jt��d�dS(Ncs
�jt�S(N(R�RU((R�(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��RR�Ri(R�R?R@R�R�RR�(R((R�s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_postcommand�s





c	s��fd�}�j�jdtd#kr1d$nd�|dd��j�jdddd%��j�jdd&��j�jdd'��j�jdtd(kr�d)nd�dddg�jd<�jjd�|dd��jjd�|dd��jjd�|dd��jjd�d*�jd<|dd��jjddddg��j�jd�jr�d+nd�dddg�jd<�j�jd�jr�d,nd�ddd g�jd<�j�jd�jr�d-nd!��jt	j
�jjt�jd���jt	j
�jjd�tj
�jddddg�}�j|d�jr�d.nd"�|j�dS(/Ncs6�j�jj�|��j�jj�|�dS(N(RR�R�tcurrent(tgetvaltcurrval(R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pytcheck_get_current�sR�iiRi����smon tue wed thurR"tmonttuetwedtthuri*g��Q�	@s
any stringR�itciitdit1t2s1 {} 2sa bsa	bsa
bs{a b} {a	b} {a
b}sa\tbs"a"s} {sa\\tb {"a"} \}\ \{s1 2 {}(ii((R�R�R�R(R�R�R�R(i*g��Q�	@Rs
any string(ii((iiRi(RRR(sa bsa	bsa
b(sa\tbs"a"s} {(RRR(RR�RR,tsetR�t	configuretwantobjectsRFRGRR�R<R�R>R|(RR�tcombo2((Rs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_values�sL
(




!
(R�RR]R�R�R�R^R�R�R�R�RSR.R`R�R�R�R�R7R�(
R4R5RcR;RR�R�R�R�R	(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��s						tPanedWindowTestcBsVeZdZd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Z	d�Z
RS(RR]R^torientR.R`R7cCs&tt|�j�|j�|_dS(N(R:R
R;Rtpaned(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;&scKstj|j|�S(N(R<tPanedWindowR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR*scCs�|j�}|jt|d�d�d}t�dkrDd	}n|j|dd
d|�|jdd
�}|jt|d�d
�dS(
NRtverticals"attempt to change read-only optioniiiRis"Attempt to change read-only optiont
horizontalR(iiiRi(RRR�RR(RRRR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_orient-s	cCsztj|j�}tj|�}|jtj|jj|�|j�|j�tj|j�}tj|�}|jtj|jj|�|j�|j�tj|j�}|jj|�|jtj|jj|�tj|j�}|jj|�|j	|jj
d�|jj
d��|jtj|jj
d�|j�|j�|jtj|jj
d�dS(Niii(R<R{RRFRGRtaddR|R>Rtpane(RRAtchildt
good_childtother_child((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_add8s(



(

cCs�|jtj|jjd�|jtj|jjd�|jjtj|j	��|jjd�|jtj|jjd�dS(Ni(
RFRGRRtforgetRHRR<R{R>(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_forgetTs
cCs|jtj|jjdd�|jtj|jjdd�|jtj|jjdd�tj|j�}tj|j�}tj|j�}|jtj|jjd|�|jjd|�|jjd|�|j	|jj
�t|�t|�f�|jjd|�|j	|jj
�t|�t|�f�|jjd|�|j	|jj
�t|�t|�t|�f�|jj
�}|jjd|�|j	||jj
��|jj||�|j	|jj
�t|�t|�t|�f�dS(NiR�(RFRGRRR�RHR<R{R>RtpanesR�(RRtchild2tchild3R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_insert]s*++"cCs
|jtj|jjd�tj|j�}|jj|�|j	|jjd�t
�|j|jjddd�|j
r�dnd�|j|jjdd�|j
r�dnd�|j|jjd�|jjt|���|jtj|jjddd�dS(NitweightR#t	badoptiont	somevalue(RFRGRRRR<R{R>RtassertIsInstancetdictRRHRR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt	test_pane�s.cCsi|jtj|jjd�|jtj|jjd�|jtj|jjd�tj|jdd�}|jj|dd�|jtj|jjd�tj|jdd�}|jj|�|jtj|jjd�|jj	dt
d	d
�|jj�|jjd�}|jjdd�|j||jjd��|j
|jjd�t�dS(NRiR8R�Ritbtexpandtfilltbothi�(RFRGRRtsashposRHR<R{RR?RUR@tassertNotEqualR tint(RRRtcurr_pos((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_sashpos�s
(RR]R^RR.R`R7(R4R5RcR;RRRRRR"R+(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR
s							#	tRadiobuttonTestcBs)eZdZd�Zd�Zd�ZRS(RR�R�R]R�R!RSR.R`R8R�RgtvalueR�R7cKstj|j|�S(N(R<tRadiobuttonR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�scCs,|j�}|j|ddddd�dS(NR-igffffff@Rs
any string(RR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_value�scs�g��fd�}tj|j�}tj|jd|d|dd�}tj|jd|d|dd�}|jr�d�}nt}|j�}|j|d�|j||d�|j	��|j|j	�||j
j|d���|j��d	|d<|j�}|jt
|�d	�|jt��d�|j||d�|j	��|j|j	�||j
j|d���|jt
|d�t
|d��dS(
Ncs�jd�dS(Niscb test called(R�((R�(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��s
R�R�R-iicSs|S(N((R�((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��Rscb test calledR(RGtIntVarR>R<R.RR)R�RR�R�R�R�R�R�R�(RR�tmyvarR�tcbtn2tconvR�((R�s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��s0	 

 (RR�R�R]R�R!RSR.R`R8R�RgR-R�R7(R4R5RcRR/R�(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR,�s		tMenubuttonTestcBs)eZdZd�Zd�Zd�ZRS(RR�R]t	directionR�tmenuR!RSR.R`R8R�RgR7cKstj|j|�S(N(R<t
MenubuttonR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�scCs/|j�}|j|dddddd�dS(NR5tabovetbelowR�R�tflush(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_direction�scCsH|j�}tj|dd�}|j|d|dt�|j�dS(NRyR6R3(RRGtMenuR,R�R|(RRR6((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt	test_menu�s(RR�R]R5R�R6R!RSR.R`R8R�RgR7(R4R5RcRR;R=(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR4�s		t	ScaleTestcBskeZdZeZdZd�Zd
�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d�ZRS(RR�R]tfromtlengthRR.R`ttoR-R�RcCs@tt|�j�|j�|_|jj�|jj�dS(N(R:R>R;RtscaleR?R�(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;�s
cKstj|j|�S(N(R<tScaleR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRscCs/|j�}|j|dddddt�dS(NR?idg������-@g333333.@R3(RtcheckFloatParamR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt	test_fromscCs,|j�}|j|ddddd�dS(NR@i�gffffff`@g33333�`@t5i(RtcheckPixelsParam(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_lengthsc	Cs2|j�}|j|ddddddt�dS(NRAi,g������-@g333333.@i����R3(RRDR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_tosc	Cs2|j�}|j|ddddddt�dS(NR-i,g������-@g333333.@i����R3(RRDR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR/scs�dddg�|jjd�fd��}d|jd<d|jd<d|jd<|j��dddg�|jjdd	dd
�|jjdddd�|jjdd�|j��dS(
Nis<<RangeChanged>>cs
�j�S(N(tpop(R�(tfailure(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�Ri
R?tfrom_iRAiiii����(RBR�R�R(Rtfuncid((RKs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_custom_events



cCs|jrd�}nt}|jj�}|j|jj|d�|jd�|j||jjdd��||jd��|j|jj�|jd�d|jd<|j|jj�|jd�|jtj|jjdd�|jtj|jjdd�dS(NcSs|S(N((R�((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�(RiRAR?R-iR(	RtfloatRBRDRR�RFRGR(RR3tscale_width((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_get&s	&2 
 cCs�|jrd�}nt}||jd�}|d}|jj|�|j||jj��|�||jd�}|jj|d�|j||jj��|�tj|j�}||jd<|j|d�|j||jj��|j��|j||jj��|d�~|d|jd<|j||jj��|d�|j||jj��||jd��|j||jjd	d	��|�|j||jj|jj	�d	��|�|j
tj|jjd�dS(
NcSs|S(N((R�((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�:RRAi
R?iR�iR-i(
RRORBRRR�RGt	DoubleVarR>RDRFRRH(RR3tmaxtnew_maxtmintvar((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_set8s,	

%##,%.(RR�R]R?R@RR.R`RAR-R�(R4R5RcRRZR/R;RRERHRIR/RNRQRW(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR>�s								tProgressbarTestcBsPeZdZeZdZd�Zd
�Zd�Zd�Z	d�Z
d�ZRS(RR]RR@tmodetmaximumtphaseR.R`R-R�RcKstj|j|�S(N(R<tProgressbarR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRfscCs)|j�}|j|dddd�dS(NR@gfffffY@g�����YL@t2i(RRG(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRHisc	Cs2|j�}|j|ddddddt�dS(NRZgfffff�b@g�����lS@ii����R3(RRDR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_maximummscCs&|j�}|j|ddd�dS(NRYtdeterminatet
indeterminate(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt	test_modeqscCsdS(N((R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_phaseusc	Cs2|j�}|j|ddddddt�dS(NR-gfffff�b@g�����lS@ii����R3(RRDR�(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR/ys(RR]RR@RYRZR[R.R`R-R�(R4R5RcRRZR/RRHR^RaRbR/(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRX\s					R�s"ttk.Scrollbar is special on MacOSXt
ScrollbarTestcBseZdZdZd�ZRS(	RR�R]RR.R`RcKstj|j|�S(N(R<t	ScrollbarR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�s(RR�R]RR.R`(R4R5RcR/R(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRcstNotebookTestcBsqeZdZd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Z	d�Z
d�Zd�Zd�Z
RS(RR]R^R!R.R`R7cCs�tt|�j�|jdd�|_tj|j�|_tj|j�|_	|jj
|jdd�|jj
|j	dd�dS(NR!iR8R�R#(R:ReR;RtnbR<R{R>tchild1RR(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;�scKstj|j|�S(N(R<tNotebookR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�scCs�|jjd�|jj|j�|jtj|jj|j�|j	|jj
d�d�|jj|j�|j	|jj
d�d�|jj|j�|j
|jjd��|jj|jdd�|jj�|jj�tjdkrd}nd	}|j	|jj|�|jjd��xhtd
dd
�D]G}y*|jjd|dd�dkrtPnWqEtjk
r�qEXqEW|jd
�dS(NiR�iR�R8R�R�s@20,5s@5,5iids@%d, 5sTab with text 'a' not found(RfRthideRRFRGRttabRgRtindexRtselectR�R?R@R�R�trangeRHtfail(Rttb_idxti((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_tab_identifiers�s,

	("cCs�|jtj|jjd�|jtj|jjd�|jtj|jjd�|jtj|jjd�|jtj|jjtj|j	�dd�|jj
�}|jj|j�|jj|j�|j|jj
�|�tj|j	�}|jj|dd�|jj
�}|jj
d�}|jj
|j�}|jj|j�|jj|j�|j|jj
�|�|j|jj
|j�|�|jt|j�|jj
�|�|j|jj
d�|d�dS(	Ni����ROtunknowntoptionR8RR�i(RFRGRRfRiRHRR<R{R>ttabsRgRRkRR�(RRtRtcurrtchild2_index((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_add_and_hidden�s*'&cCs+|jtj|jjd�|jtj|jjd�|jtj|jjd�|jj�}|jj|j�}|jj|j�|j	t
|j�|jj��|jt|�dt|jj���|jj
|j�|j|jj|j�d�|j||jj|j��dS(Ni����ROi(RFRGRRfRRHRtRkRgtassertNotInR�RR�RR((RRttchild1_index((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�s")cCs�|jtj|jjd�|jtj|jjd�|j|jjd�t�|j|jj|j	�d�|j|jj|j
�d�|j|jjd�d�dS(Ni����R�iii(RFRGRRfRkRHR R)RRgR(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_index�scCs�|jj�}|jjd|d�|j|jj�|d|df�|jj|j|j�|j|jj�|�|jjd|j�|j|jj�|d|df�|jjdd�|j|jj�|�|jtj|jjd|d�|jtj|jjd|d�t	j
|j�}|jjd|�|j|jj�|dt|�|df�|jj
|�|j|jj�|�|jj|j|�|j|jj�t|�f|�|jj
|�|jtj|jjd|�|jtj|jjd|�|jtj|jjdd�|jtj|jjdd�|jtj|jjdd�dS(NiiR�ii����(RfRtR�RRgRRFRGRR<R{R>R�RRH(RRtR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�s0''##0&cs�|jj�|jj�g�g�|jjd�fd��|jjd�fd��|j|jj�t|j��|jj|j�|j	��|j|jj�t|j��|jj
�|j	��dS(Ns<Unmap>cs
�jt�S(N(R�RU(R�(R�(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�Rs<<NotebookTabChanged>>cs
�jt�S(N(R�RU(R�(ttab_changed(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�R(RfR?R@RgR�RRlR�RR�R�(R((R�R{s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_selects

"
"
cCs|jtj|jjd�|jtj|jjd�|jtj|jjd�|j|jj|j�t�|j	|jj|jdd�d�|j	|jj|jd�d�|jj|jdd�|j	|jj|jdd�d�|j	|jj|jd�d�dS(Ni����tnotabR8R�tabc(
RFRGRRfRjRHR RgR!R(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_tab(s%"%cCsb|jt|jj��d�|jj|j�|jj|j�|j|jj�d�dS(Ni((RR�RfRtRRgR(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt	test_tabs6scCs�|jj�|jj�|jjd�t|jdd�|jj�|jjd�|j|jj�t|j	��|jj�|jjd�|j|jj�t|j
��|jj�|jjd�|j|jj�t|j	��|jj|j
dddd�|jj�|jj�t|jdd�t
jdkrh|jjd	�n|jjd
�|j|jj�t|j
��dS(Niis
<Control-Tab>s<Shift-Control-Tab>R8R�RgR�s
<Option-a>s<Alt-a>(RfR?R@RlR	tfocus_forceR�RR�RRgRjtenable_traversalR�R�(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_traversal?s*


"
"
"

(RR]R^R!R.R`R7(R4R5RcR;RRqRwRRzRR|RR�R�(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRe�s						
	!				tTreeviewTestcBs�eZd#Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd �Zd!�Zd"�ZRS($RtcolumnsR]tdisplaycolumnsR^R!t
selectmodeR�R.R`R�tyscrollcommandcCs,tt|�j�|jdd�|_dS(NR!i(R:R�R;Rttv(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;cscKstj|j|�S(N(R<tTreeviewR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRgscCsa|j�}|j|dddd
�|j|dd�|j|dtdkrVd
nd	�dS(NR�sa b cR"R�R#RiiR(R�R#R(R�R#R(ii((RR,R(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_columnsjs
cCs�|j�}d|d<|j|dddd�|j|dd�|j|dddd�|j|dd�|j|ddd
d�|j|ddd
d�|j|ddd
d�dS(NR�R#RR�R�sb a cR"s#alliiiRRsInvalid column index disColumn index 3 out of boundsi����sColumn index -2 out of bounds(R�R#R(R#R�R(R#R�R(s#all(iii(R�R#R(iii(ii����(RR,R(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_displaycolumnsqs
c	CsN|j�}|j|ddddddt�|j|ddddt�dS(	NR^idi����it3cR3g�����LY@gfffff�Y@(RRGR�R(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��s"cCs)|j�}|j|dddd�dS(NR�R�tbrowsetextended(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_selectmode�scCs�|j�}|j|dddd�|j|dd�|j|dd�|j|dddd	�|j|dddd
�dS(NR�s
tree headingsR"ttreetheadings(R�R�(R�R�(R�R�(R�(R�(RR,(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��scCsW|jj�|j|jjd�d�|jj�|jj�|jjdd�}|jj�}|j|�|jj|d�}|j	|�dg|jd<|jj
ddd�|jj|dd�}|jj
ddd�}|jst
|�}n|j|d|d|�|jj|d�}|j|jj|�d�dS(	NRR�ittestR�R7i2s#0(R�R?RR�R@R�R�tget_childrenR�R�tcolumnRHRR)(Rtitem_idtchildrenR�tbbox_column0t
root_widthRg((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��s$




	cCs>|j|jj�d�|jjdd�}|j|jj�t�|j|jj�d|�|jjdd�}|jjdd�}|jj|||�|j|jj|�||f�|jtj	|jj||�|jj|�|j|jj|�d�|jjd�|j|jj�d�dS(NRR�i((((
RR�R�R�R ttupletset_childrenRFRGR(RR�RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_children�s"cCsi|j|jjd�t�|jrJ|j|jjddd�t�n|jjddd�|j|jjdd�|jr�dnd�|j|jjddd�|jr�dnd�|jt	j
|jjddd�|jt	j
|jjd�idd	6id
d6id
d6id
d6id
d
6g}x-|D]%}|jt	j
|jjd|�q<WdS(Ns#0R7i
t10tidtXR�s
some valuetunknown_optiontwrongtstretchR�tminwidth(R R�R�R!RRHR)RRFRGR(Rtinvalid_kwsRM((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_column�s	%"$
cCs?|jtj|jjd�|jjdd�}|jj|d�}|j|jj�|f�|j|jj|�|f�|jj|�|j|jj��|jtj|jj	|dd�|jjdd�}|jjdd�}|j|jj�||f�|jj||�|j|jj��dS(Ns#0RR�(
RFRGRR�R�R�RR�R�treattach(RR�titem2titem1((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_delete�scCs0|jjdd�}|jj|d�}|jj�}|jj�|j||jj��|j|jj�|f�|j|jj|�|f�|jj|�|j|jj��|jj|dd�|j|jj�|f�|j|jj|�|f�|jj|dd�|j|jj�||f�|j|jj|�d�|jt	j
|jjddd�|jt	j
|jjd�|jt	j
|jj|dd�|jt	j
|jj|dd�|jj||�|j|jj�d�|j|jj|�d�dS(	NRR�tnonexistenttotherparentR�((((R�R�R�tdetachRR�R�tmoveRFRGR(RR�R�tprev((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_detach_reattach�s4
cCst|j|jjd�t�|j|jjd�t�|j|jji�t�|jtj|jjd�dS(Nt	somethingR(	RR�texistsR�RURFRGRRH(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_exists'scCs�|j|jj�d�|jjdd�}|jj|�|j|jj�|�|jj|�|j|jj�d�|jtj|jjd�dS(NRR�RO(RR�R�R�R�RFRGR(RR�((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_focus2scCs�|j|jjd�t�|jjddd�|j|jjdd�d�|j|jjddd�d�|jtj|jjddd�|jtj|jjddd�dS(Ns#0R8ROR�R�i(	R R�theadingR!RRHRFRGR(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_headingAs"cs�fd�}g��jj��jj��jjdd�fd���jjddd��jj�|dd��s��jd�ng��jjj}�jjddt	�jjddd����j|�jjj�|dd��s�jd�ndS(	Ncs$t�j||��jj�dS(N(R	R�R�(R�R�(R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pytsimulate_heading_clickRss#0R�cs
�jt�S(N(R�RU((R�(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�ZRR7idis>The command associated to the treeview heading wasn't invoked.(R�R?R@R�R�R�RnRt_tclCommandsR�RHR(RR�tcommands((RR�s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_heading_callbackQs"



.
cCs�|jtj|jjd�|j|jjd�d�|jjdd�}|jjdd�}|jj|d�}|jj|d�}|j|jj|�d�|j|jj|�d�|j|jj|�d�|j|jj|�d�|jj|dd�|j|jj|�d�|j|jj|�d�|jj|�|j|jj|�d�|jj|�|j|jj|�d�|jj	|�|jtj|jj|�dS(NtwhatRiR�i(
RFRGRR�RkRR�R�R�R�(RR�R�tc1tc2((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRzss&cCs�|jtj|jjdd�|jtj|jjdddd�|jtj|jjdddd�|j|jj|jjdddt���|j|jj|jjdddt���|jtj|jjdd�|jjddd�}|j	|d�|jtj|jjddd�|jtj|jjddt
d��d}|jjddd	|f�}|j	|jj|d	�|jr�|fn|�|j	|jj|d	d�|jr�|fn|�|jj|d	|jj|jj|d	d���|j	|jj|d	d�|jr@|fn|�|j|jj|�t�|jj|d	d�|j|jj|d	d��|jjddd
dd|g�}|j	|jj|d
d�|jr�d
d|fnd|�|jj|d
g�|j|jj|d
d��|jj|d
d�|j	|jj|d
d�|jrodnd�|jjddd	dd||ff�}|j	|jj|d	d�|jr�dd||ffn
d||f�|j	|jj|jjdddd�dd�d�|j	|jj|jjddd|�dd�|�|jjddd�}|j	|d�|jjddd�}|j	|d�|jtj|jjddt�|jtj|jjddd�dS(NR�R�Rtopentpleasetmiddles
first-itemuábaR�ttagsiiRRs1 2 %ss1 2sa b cs%s %ss{a b c} {%s %s}R8s
Label hereiR#gs0.0(ii(RR(RFRGRR�R�R�R�RUR�RRtitemRRHR>t	splitlistR R!(RtitemidR-R�((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_insert_item�sh..
4$!!"cCs�|jtj|jjd�|jtj|jjd�|jtj|jjd�|jtj|jjd�|jjdd�}|jjdd�}|jj|d�}|jj|d�}|jj|d�}|j	|jj
�d
�|jj||f�|j	|jj
�||f�|jj|�|j	|jj
�|f�|jj||f�|j	|jj
�|||f�|jj|�|j	|jj
�||||f�|jj||f�|j	|jj
�|||f�|jj|�|j	|jj
�||f�|jj||f�|j	|jj
�||f�|jj|�|j	|jj
�|f�|jjdddd�|jjd�|j	|jj
�d�|jjdddd�|jjd�|j	|jj
�d�trl|jjdddtd��|jjtd��|j	|jj
�td�f�n|jjdddd�|jjd�|j	|jj
�tr�td	�ndf�dS(
NR�RR�R�swith spacess{braces
unicode\u20acsbytes€sbytes\u20ac((swith spaces(s{brace(
RFRGRR�t
selection_sett
selection_addtselection_removetselection_toggleR�Rt	selectionRR(RR�R�R�R�tc3((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_selection�sR"%"%cCsPddg|jd<|jjdddddg�}|j|jj|�idd6dd6�|jj|dd�|j|jj|dd�|jr�dnd	�dg|jd<|j|jj|�idd6�|jj|dd�|j|jj|d
d�d�|j|jj|dd�|jr:dnd�|jj|dd�|j|jj|d�|jr~dnd
�|j|jj|dd�|jr�dnd�|j|jj|�|jr�idd6n
id
d6�|jtj	|jj|d�|jtj	|jj|dd�|jtj	|jjd�dS(NtAtBR�RR�R�R�R#sa aR�sb ai{t123s123 atnotme(R�R�(R#R�(i{R�(
R�R�RRR�RHRRFRGR(RR�((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRWs,!*#"$"c	s�g�|jjddddg�}|jjddddg�}|jjdd�fd��|jjdd�fd��|jj�|jj�|jj�t�}t�}xqtd	d
d�D]]}t|�dkr�Pn|jj	|�}|r�||kr�|j
|�|j
|�q�q�W|jt|�d�x!|D]}t|jd	|�qJW|jt��d
�xAt
�ddd��ddd��D]}|j|d�q�WdS(NRR�R�tcalls<ButtonPress-1>cs
�jd�S(Ni(R�(R�(tevents(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�;Rs<ButtonRelease-1>cs
�jd�S(Ni(R�(R�(R�(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�=Riidi
iii(ii(R�R�ttag_bindR?R@R�RRmR�tidentify_rowRRR	tzip(	RR�R�tpos_ytfoundRpR�R�R�((R�s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt
test_tag_bind6s2


		

0cCs�|jt|jj�|jtj|jjddd�|jjddd�|jt|jjdd��d�|jt|jjddd��d�|j	|jjd�t
�dS(NR�tskytblueR�(RFt	TypeErrorR�t
tag_configureRGRRR�RHR R!(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_tag_configureXs
!cCs�|jjddddddg�}|jjddddddg�}|jt|jj�|jt|jjdd	�|j|jjd|��|j|jjd|��|j|jjd|��|j|jjd|��|j|jjd
|��|j|jjd
|��|j|jjd�|f�|j|jjd�|f�|j|jjd
�d�dS(NRR�R8sItem 1R�ttag1sItem 2ttag2snon-existingttag3((	R�R�RFR�ttag_hasRR�R�R(RR�R�((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_tag_hasds$$(RR�R]R�R^R!R�R�R.R`R�R�(R4R5RcR;RR�R�R�R�R�R�R�R�R�R�R�R�R�R�RzR�R�RWR�R�R�(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�[s4													*				"		M	6	!	"	t
SeparatorTestcBseZdZdZd�ZRS(RR]RR.R`RcKstj|j|�S(N(R<t	SeparatorR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR|s(RR]RR.R`(R4R5RcR/R(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�tstSizegripTestcBseZdZd�ZRS(RR]R.R`cKstj|j|�S(N(R<tSizegripR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR�s(RR]R.R`(R4R5RcR(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR��st__main__(5tunittesttTkinterRGRR<ttest.test_supportRRRRR�ttest_functionsRtsupportRRRR	twidget_testsR
RRR
RRRRRtTestCaseR6RYR[RdR~R�R�R�R�R�R
R,R4R>RXtskipIfR�RcReR�R�R�t	tests_guiR4(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt<module>sr"":
';0�|�3j"
���	runtktests.py000064400000004305150351526610007352 0ustar00"""
Use this module to get and run all tk tests.

Tkinter tests should live in a package inside the directory where this file
lives, like test_tkinter.
Extensions also should live in packages following the same rule as above.
"""

import os
import sys
import unittest
import importlib
import test.test_support

this_dir_path = os.path.abspath(os.path.dirname(__file__))

def is_package(path):
    for name in os.listdir(path):
        if name in ('__init__.py', '__init__.pyc', '__init.pyo'):
            return True
    return False

def get_tests_modules(basepath=this_dir_path, gui=True, packages=None):
    """This will import and yield modules whose names start with test_
    and are inside packages found in the path starting at basepath.

    If packages is specified it should contain package names that want
    their tests collected.
    """
    py_ext = '.py'

    for dirpath, dirnames, filenames in os.walk(basepath):
        for dirname in list(dirnames):
            if dirname[0] == '.':
                dirnames.remove(dirname)

        if is_package(dirpath) and filenames:
            pkg_name = dirpath[len(basepath) + len(os.sep):].replace('/', '.')
            if packages and pkg_name not in packages:
                continue

            filenames = filter(
                    lambda x: x.startswith('test_') and x.endswith(py_ext),
                    filenames)

            for name in filenames:
                try:
                    yield importlib.import_module(
                            ".%s" % name[:-len(py_ext)], pkg_name)
                except test.test_support.ResourceDenied:
                    if gui:
                        raise

def get_tests(text=True, gui=True, packages=None):
    """Yield all the tests in the modules found by get_tests_modules.

    If nogui is True, only tests that do not require a GUI will be
    returned."""
    attrs = []
    if text:
        attrs.append('tests_nogui')
    if gui:
        attrs.append('tests_gui')
    for module in get_tests_modules(gui=gui, packages=packages):
        for attr in attrs:
            for test in getattr(module, attr, ()):
                yield test

if __name__ == "__main__":
    test.test_support.run_unittest(*get_tests())
test_tkinter/test_variables.py000064400000020305150351526610012650 0ustar00import unittest
import gc
from Tkinter import (Variable, StringVar, IntVar, DoubleVar, BooleanVar, Tcl,
                     TclError)


class TestBase(unittest.TestCase):

    def setUp(self):
        self.root = Tcl()

    def tearDown(self):
        del self.root


class TestVariable(TestBase):

    def info_exists(self, *args):
        return self.root.getboolean(self.root.call("info", "exists", *args))

    def test_default(self):
        v = Variable(self.root)
        self.assertEqual("", v.get())
        self.assertRegexpMatches(str(v), r"^PY_VAR(\d+)$")

    def test_name_and_value(self):
        v = Variable(self.root, "sample string", "varname")
        self.assertEqual("sample string", v.get())
        self.assertEqual("varname", str(v))

    def test___del__(self):
        self.assertFalse(self.info_exists("varname"))
        v = Variable(self.root, "sample string", "varname")
        self.assertTrue(self.info_exists("varname"))
        del v
        self.assertFalse(self.info_exists("varname"))

    def test_dont_unset_not_existing(self):
        self.assertFalse(self.info_exists("varname"))
        v1 = Variable(self.root, name="name")
        v2 = Variable(self.root, name="name")
        del v1
        self.assertFalse(self.info_exists("name"))
        # shouldn't raise exception
        del v2
        self.assertFalse(self.info_exists("name"))

    def test___eq__(self):
        # values doesn't matter, only class and name are checked
        v1 = Variable(self.root, name="abc")
        v2 = Variable(self.root, name="abc")
        self.assertEqual(v1, v2)

        v3 = Variable(self.root, name="abc")
        v4 = StringVar(self.root, name="abc")
        self.assertNotEqual(v3, v4)

    def test_invalid_name(self):
        with self.assertRaises(TypeError):
            Variable(self.root, name=123)

    def test_null_in_name(self):
        with self.assertRaises(ValueError):
            Variable(self.root, name='var\x00name')
        with self.assertRaises(ValueError):
            self.root.globalsetvar('var\x00name', "value")
        with self.assertRaises(ValueError):
            self.root.setvar('var\x00name', "value")

    def test_trace(self):
        v = Variable(self.root)
        vname = str(v)
        trace = []
        def read_tracer(*args):
            trace.append(('read',) + args)
        def write_tracer(*args):
            trace.append(('write',) + args)
        cb1 = v.trace_variable('r', read_tracer)
        cb2 = v.trace_variable('wu', write_tracer)
        self.assertEqual(sorted(v.trace_vinfo()), [('r', cb1), ('wu', cb2)])
        self.assertEqual(trace, [])

        v.set('spam')
        self.assertEqual(trace, [('write', vname, '', 'w')])

        trace = []
        v.get()
        self.assertEqual(trace, [('read', vname, '', 'r')])

        trace = []
        info = sorted(v.trace_vinfo())
        v.trace_vdelete('w', cb1)  # Wrong mode
        self.assertEqual(sorted(v.trace_vinfo()), info)
        with self.assertRaises(TclError):
            v.trace_vdelete('r', 'spam')  # Wrong command name
        self.assertEqual(sorted(v.trace_vinfo()), info)
        v.trace_vdelete('r', (cb1, 43)) # Wrong arguments
        self.assertEqual(sorted(v.trace_vinfo()), info)
        v.get()
        self.assertEqual(trace, [('read', vname, '', 'r')])

        trace = []
        v.trace_vdelete('r', cb1)
        self.assertEqual(v.trace_vinfo(), [('wu', cb2)])
        v.get()
        self.assertEqual(trace, [])

        trace = []
        del write_tracer
        gc.collect()
        v.set('eggs')
        self.assertEqual(trace, [('write', vname, '', 'w')])

        #trace = []
        #del v
        #gc.collect()
        #self.assertEqual(trace, [('write', vname, '', 'u')])


class TestStringVar(TestBase):

    def test_default(self):
        v = StringVar(self.root)
        self.assertEqual("", v.get())

    def test_get(self):
        v = StringVar(self.root, "abc", "name")
        self.assertEqual("abc", v.get())
        self.root.globalsetvar("name", "value")
        self.assertEqual("value", v.get())

    def test_get_null(self):
        v = StringVar(self.root, "abc\x00def", "name")
        self.assertEqual("abc\x00def", v.get())
        self.root.globalsetvar("name", "val\x00ue")
        self.assertEqual("val\x00ue", v.get())


class TestIntVar(TestBase):

    def test_default(self):
        v = IntVar(self.root)
        self.assertEqual(0, v.get())

    def test_get(self):
        v = IntVar(self.root, 123, "name")
        self.assertEqual(123, v.get())
        self.root.globalsetvar("name", "345")
        self.assertEqual(345, v.get())

    def test_invalid_value(self):
        v = IntVar(self.root, name="name")
        self.root.globalsetvar("name", "value")
        with self.assertRaises(ValueError):
            v.get()
        self.root.globalsetvar("name", "345.0")
        with self.assertRaises(ValueError):
            v.get()


class TestDoubleVar(TestBase):

    def test_default(self):
        v = DoubleVar(self.root)
        self.assertEqual(0.0, v.get())

    def test_get(self):
        v = DoubleVar(self.root, 1.23, "name")
        self.assertAlmostEqual(1.23, v.get())
        self.root.globalsetvar("name", "3.45")
        self.assertAlmostEqual(3.45, v.get())

    def test_get_from_int(self):
        v = DoubleVar(self.root, 1.23, "name")
        self.assertAlmostEqual(1.23, v.get())
        self.root.globalsetvar("name", "3.45")
        self.assertAlmostEqual(3.45, v.get())
        self.root.globalsetvar("name", "456")
        self.assertAlmostEqual(456, v.get())

    def test_invalid_value(self):
        v = DoubleVar(self.root, name="name")
        self.root.globalsetvar("name", "value")
        with self.assertRaises(ValueError):
            v.get()


class TestBooleanVar(TestBase):

    def test_default(self):
        v = BooleanVar(self.root)
        self.assertIs(v.get(), False)

    def test_get(self):
        v = BooleanVar(self.root, True, "name")
        self.assertIs(v.get(), True)
        self.root.globalsetvar("name", "0")
        self.assertIs(v.get(), False)
        self.root.globalsetvar("name", 42 if self.root.wantobjects() else 1)
        self.assertIs(v.get(), True)
        self.root.globalsetvar("name", 0)
        self.assertIs(v.get(), False)
        self.root.globalsetvar("name", 42L if self.root.wantobjects() else 1L)
        self.assertIs(v.get(), True)
        self.root.globalsetvar("name", 0L)
        self.assertIs(v.get(), False)
        self.root.globalsetvar("name", "on")
        self.assertIs(v.get(), True)
        self.root.globalsetvar("name", u"0")
        self.assertIs(v.get(), False)
        self.root.globalsetvar("name", u"on")
        self.assertIs(v.get(), True)

    def test_set(self):
        true = 1 if self.root.wantobjects() else "1"
        false = 0 if self.root.wantobjects() else "0"
        v = BooleanVar(self.root, name="name")
        v.set(True)
        self.assertEqual(self.root.globalgetvar("name"), true)
        v.set("0")
        self.assertEqual(self.root.globalgetvar("name"), false)
        v.set(42)
        self.assertEqual(self.root.globalgetvar("name"), true)
        v.set(0)
        self.assertEqual(self.root.globalgetvar("name"), false)
        v.set(42L)
        self.assertEqual(self.root.globalgetvar("name"), true)
        v.set(0L)
        self.assertEqual(self.root.globalgetvar("name"), false)
        v.set("on")
        self.assertEqual(self.root.globalgetvar("name"), true)
        v.set(u"0")
        self.assertEqual(self.root.globalgetvar("name"), false)
        v.set(u"on")
        self.assertEqual(self.root.globalgetvar("name"), true)

    def test_invalid_value_domain(self):
        false = 0 if self.root.wantobjects() else "0"
        v = BooleanVar(self.root, name="name")
        with self.assertRaises(TclError):
            v.set("value")
        self.assertEqual(self.root.globalgetvar("name"), false)
        self.root.globalsetvar("name", "value")
        with self.assertRaises(TclError):
            v.get()
        self.root.globalsetvar("name", "1.0")
        with self.assertRaises(TclError):
            v.get()


tests_gui = (TestVariable, TestStringVar, TestIntVar,
             TestDoubleVar, TestBooleanVar)


if __name__ == "__main__":
    from test.support import run_unittest
    run_unittest(*tests_gui)
test_tkinter/test_misc.pyo000064400000007400150351526610012013 0ustar00�
zfc@s�ddlZddlZddlmZmZddlmZed�deejfd��YZ	e	fZ
edkr�ee
�ndS(i����N(trequirestrun_unittest(tAbstractTkTesttguitMiscTestcBs#eZd�Zd�Zd�ZRS(cs�|j}idd6�dd�fd�}|j|jd��d�d<|jd|�}|j||jjdd��|jj|jjdd|��\}}|j�|j�dd�|j	t
j��|jj|�WdQXd�d<|jd|dd�}|j�|j�dd	�|jd
|�}|j||jjdd��|jj|jjdd|��\}}|j|�|j�dd	�|j	t
j��|jj|�WdQXdS(Nitcountics||�d<dS(NR((tstarttstep(tcbcount(s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_misc.pytcallbackstaftertinfoi*ii5i�(
troottassertIsNoneR
tassertInttktcallt	splitlisttupdatetassertEqualtassertRaisesttkintertTclErrortafter_cancel(tselfRR	ttimer1tscriptt_((Rs:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_misc.pyt
test_after
s.	

*


*
cs�|j}idd6�dd�fd�}d�d<|j|�}|j||jjdd��|jj|jjdd|��\}}|j�|j�dd�|jt	j
��|jj|�WdQXd�d<|j|dd�}|j�|j�dd	�|j|�}|j||jjdd��|jj|jjdd|��\}}|j|�|j�dd	�|jt	j
��|jj|�WdQXdS(
NiRics||�d<dS(NR((RR(R(s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_misc.pyR	1sR
Ri*ii5(Rt
after_idleRRRRtupdate_idletasksRRRRR(RRR	tidle1RR((Rs:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_misc.pyttest_after_idle-s,	

*


*
cs|j}idd6��fd�}|jd|�}|j|�}|jt��|jd�WdQXd�d<|jj|jj	dd|��\}}|jj	|�|j
�dd�|j|�|jtj��|jj	|�WdQX|j
�dd�|jtj��|jj	dd|�WdQX|j|�d�d<|jj|jj	dd|��\}}|jj	|�|j
�dd�|j|�|jtj��|jj	|�WdQX|j
�dd�|jtj��|jj	dd|�WdQXdS(NiRcs�dcd7<dS(NRi(((R(s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_misc.pyR	Qsi�R
Ri(
RR
RRt
ValueErrorRtNoneRRRRRR(RRR	RRRR((Rs:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_misc.pyttest_after_cancelMs8	

*


*
(t__name__t
__module__RR R#(((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_misc.pyRs	#	 t__main__(tunittesttTkinterRttest.test_supportRRttest_ttk.supportRtTestCaseRt	tests_guiR$(((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_misc.pyt<module>s
o	test_tkinter/test_widgets.py000064400000134207150351526610012355 0ustar00import unittest
import Tkinter as tkinter
from Tkinter import TclError
import os
import sys
from test.test_support import requires, run_unittest

from test_ttk.support import (tcl_version, requires_tcl, get_tk_patchlevel,
                              widget_eq)
from widget_tests import (
    add_standard_options, noconv, noconv_meth, int_round, pixels_round,
    AbstractWidgetTest, StandardOptionsTests,
    IntegerSizeTests, PixelSizeTests,
    setUpModule)

requires('gui')


class AbstractToplevelTest(AbstractWidgetTest, PixelSizeTests):
    _conv_pad_pixels = noconv_meth

    def test_class(self):
        widget = self.create()
        self.assertEqual(widget['class'],
                         widget.__class__.__name__.title())
        self.checkInvalidParam(widget, 'class', 'Foo',
                errmsg="can't modify -class option after widget is created")
        widget2 = self.create(class_='Foo')
        self.assertEqual(widget2['class'], 'Foo')

    def test_colormap(self):
        widget = self.create()
        self.assertEqual(widget['colormap'], '')
        self.checkInvalidParam(widget, 'colormap', 'new',
                errmsg="can't modify -colormap option after widget is created")
        widget2 = self.create(colormap='new')
        self.assertEqual(widget2['colormap'], 'new')

    def test_container(self):
        widget = self.create()
        self.assertEqual(widget['container'], 0 if self.wantobjects else '0')
        self.checkInvalidParam(widget, 'container', 1,
                errmsg="can't modify -container option after widget is created")
        widget2 = self.create(container=True)
        self.assertEqual(widget2['container'], 1 if self.wantobjects else '1')

    def test_visual(self):
        widget = self.create()
        self.assertEqual(widget['visual'], '')
        self.checkInvalidParam(widget, 'visual', 'default',
                errmsg="can't modify -visual option after widget is created")
        widget2 = self.create(visual='default')
        self.assertEqual(widget2['visual'], 'default')


@add_standard_options(StandardOptionsTests)
class ToplevelTest(AbstractToplevelTest, unittest.TestCase):
    OPTIONS = (
        'background', 'borderwidth',
        'class', 'colormap', 'container', 'cursor', 'height',
        'highlightbackground', 'highlightcolor', 'highlightthickness',
        'menu', 'padx', 'pady', 'relief', 'screen',
        'takefocus', 'use', 'visual', 'width',
    )

    def create(self, **kwargs):
        return tkinter.Toplevel(self.root, **kwargs)

    def test_menu(self):
        widget = self.create()
        menu = tkinter.Menu(self.root)
        self.checkParam(widget, 'menu', menu, eq=widget_eq)
        self.checkParam(widget, 'menu', '')

    def test_screen(self):
        widget = self.create()
        self.assertEqual(widget['screen'], '')
        try:
            display = os.environ['DISPLAY']
        except KeyError:
            self.skipTest('No $DISPLAY set.')
        self.checkInvalidParam(widget, 'screen', display,
                errmsg="can't modify -screen option after widget is created")
        widget2 = self.create(screen=display)
        self.assertEqual(widget2['screen'], display)

    def test_use(self):
        widget = self.create()
        self.assertEqual(widget['use'], '')
        parent = self.create(container=True)
        # hex() adds the 'L' suffix for longs
        wid = '%#x' % parent.winfo_id()
        widget2 = self.create(use=wid)
        self.assertEqual(widget2['use'], wid)


@add_standard_options(StandardOptionsTests)
class FrameTest(AbstractToplevelTest, unittest.TestCase):
    OPTIONS = (
        'background', 'borderwidth',
        'class', 'colormap', 'container', 'cursor', 'height',
        'highlightbackground', 'highlightcolor', 'highlightthickness',
        'padx', 'pady', 'relief', 'takefocus', 'visual', 'width',
    )

    def create(self, **kwargs):
        return tkinter.Frame(self.root, **kwargs)


@add_standard_options(StandardOptionsTests)
class LabelFrameTest(AbstractToplevelTest, unittest.TestCase):
    OPTIONS = (
        'background', 'borderwidth',
        'class', 'colormap', 'container', 'cursor',
        'font', 'foreground', 'height',
        'highlightbackground', 'highlightcolor', 'highlightthickness',
        'labelanchor', 'labelwidget', 'padx', 'pady', 'relief',
        'takefocus', 'text', 'visual', 'width',
    )

    def create(self, **kwargs):
        return tkinter.LabelFrame(self.root, **kwargs)

    def test_labelanchor(self):
        widget = self.create()
        self.checkEnumParam(widget, 'labelanchor',
                            'e', 'en', 'es', 'n', 'ne', 'nw',
                            's', 'se', 'sw', 'w', 'wn', 'ws')
        self.checkInvalidParam(widget, 'labelanchor', 'center')

    def test_labelwidget(self):
        widget = self.create()
        label = tkinter.Label(self.root, text='Mupp', name='foo')
        self.checkParam(widget, 'labelwidget', label, expected='.foo')
        label.destroy()


class AbstractLabelTest(AbstractWidgetTest, IntegerSizeTests):
    _conv_pixels = noconv_meth

    def test_highlightthickness(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'highlightthickness',
                              0, 1.3, 2.6, 6, -2, '10p')


@add_standard_options(StandardOptionsTests)
class LabelTest(AbstractLabelTest, unittest.TestCase):
    OPTIONS = (
        'activebackground', 'activeforeground', 'anchor',
        'background', 'bitmap', 'borderwidth', 'compound', 'cursor',
        'disabledforeground', 'font', 'foreground', 'height',
        'highlightbackground', 'highlightcolor', 'highlightthickness',
        'image', 'justify', 'padx', 'pady', 'relief', 'state',
        'takefocus', 'text', 'textvariable',
        'underline', 'width', 'wraplength',
    )

    def create(self, **kwargs):
        return tkinter.Label(self.root, **kwargs)


@add_standard_options(StandardOptionsTests)
class ButtonTest(AbstractLabelTest, unittest.TestCase):
    OPTIONS = (
        'activebackground', 'activeforeground', 'anchor',
        'background', 'bitmap', 'borderwidth',
        'command', 'compound', 'cursor', 'default',
        'disabledforeground', 'font', 'foreground', 'height',
        'highlightbackground', 'highlightcolor', 'highlightthickness',
        'image', 'justify', 'overrelief', 'padx', 'pady', 'relief',
        'repeatdelay', 'repeatinterval',
        'state', 'takefocus', 'text', 'textvariable',
        'underline', 'width', 'wraplength')

    def create(self, **kwargs):
        return tkinter.Button(self.root, **kwargs)

    def test_default(self):
        widget = self.create()
        self.checkEnumParam(widget, 'default', 'active', 'disabled', 'normal')


@add_standard_options(StandardOptionsTests)
class CheckbuttonTest(AbstractLabelTest, unittest.TestCase):
    OPTIONS = (
        'activebackground', 'activeforeground', 'anchor',
        'background', 'bitmap', 'borderwidth',
        'command', 'compound', 'cursor',
        'disabledforeground', 'font', 'foreground', 'height',
        'highlightbackground', 'highlightcolor', 'highlightthickness',
        'image', 'indicatoron', 'justify',
        'offrelief', 'offvalue', 'onvalue', 'overrelief',
        'padx', 'pady', 'relief', 'selectcolor', 'selectimage', 'state',
        'takefocus', 'text', 'textvariable',
        'tristateimage', 'tristatevalue',
        'underline', 'variable', 'width', 'wraplength',
    )

    def create(self, **kwargs):
        return tkinter.Checkbutton(self.root, **kwargs)


    def test_offvalue(self):
        widget = self.create()
        self.checkParams(widget, 'offvalue', 1, 2.3, '', 'any string')

    def test_onvalue(self):
        widget = self.create()
        self.checkParams(widget, 'onvalue', 1, 2.3, '', 'any string')


@add_standard_options(StandardOptionsTests)
class RadiobuttonTest(AbstractLabelTest, unittest.TestCase):
    OPTIONS = (
        'activebackground', 'activeforeground', 'anchor',
        'background', 'bitmap', 'borderwidth',
        'command', 'compound', 'cursor',
        'disabledforeground', 'font', 'foreground', 'height',
        'highlightbackground', 'highlightcolor', 'highlightthickness',
        'image', 'indicatoron', 'justify', 'offrelief', 'overrelief',
        'padx', 'pady', 'relief', 'selectcolor', 'selectimage', 'state',
        'takefocus', 'text', 'textvariable',
        'tristateimage', 'tristatevalue',
        'underline', 'value', 'variable', 'width', 'wraplength',
    )

    def create(self, **kwargs):
        return tkinter.Radiobutton(self.root, **kwargs)

    def test_value(self):
        widget = self.create()
        self.checkParams(widget, 'value', 1, 2.3, '', 'any string')


@add_standard_options(StandardOptionsTests)
class MenubuttonTest(AbstractLabelTest, unittest.TestCase):
    OPTIONS = (
        'activebackground', 'activeforeground', 'anchor',
        'background', 'bitmap', 'borderwidth',
        'compound', 'cursor', 'direction',
        'disabledforeground', 'font', 'foreground', 'height',
        'highlightbackground', 'highlightcolor', 'highlightthickness',
        'image', 'indicatoron', 'justify', 'menu',
        'padx', 'pady', 'relief', 'state',
        'takefocus', 'text', 'textvariable',
        'underline', 'width', 'wraplength',
    )
    _conv_pixels = staticmethod(pixels_round)

    def create(self, **kwargs):
        return tkinter.Menubutton(self.root, **kwargs)

    def test_direction(self):
        widget = self.create()
        self.checkEnumParam(widget, 'direction',
                'above', 'below', 'flush', 'left', 'right')

    def test_height(self):
        widget = self.create()
        self.checkIntegerParam(widget, 'height', 100, -100, 0, conv=str)

    test_highlightthickness = StandardOptionsTests.test_highlightthickness.im_func

    @unittest.skipIf(sys.platform == 'darwin',
                     'crashes with Cocoa Tk (issue19733)')
    def test_image(self):
        widget = self.create()
        image = tkinter.PhotoImage(master=self.root, name='image1')
        self.checkParam(widget, 'image', image, conv=str)
        errmsg = 'image "spam" doesn\'t exist'
        with self.assertRaises(tkinter.TclError) as cm:
            widget['image'] = 'spam'
        if errmsg is not None:
            self.assertEqual(str(cm.exception), errmsg)
        with self.assertRaises(tkinter.TclError) as cm:
            widget.configure({'image': 'spam'})
        if errmsg is not None:
            self.assertEqual(str(cm.exception), errmsg)

    def test_menu(self):
        widget = self.create()
        menu = tkinter.Menu(widget, name='menu')
        self.checkParam(widget, 'menu', menu, eq=widget_eq)
        menu.destroy()

    def test_padx(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'padx', 3, 4.4, 5.6, '12m')
        self.checkParam(widget, 'padx', -2, expected=0)

    def test_pady(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'pady', 3, 4.4, 5.6, '12m')
        self.checkParam(widget, 'pady', -2, expected=0)

    def test_width(self):
        widget = self.create()
        self.checkIntegerParam(widget, 'width', 402, -402, 0, conv=str)


class OptionMenuTest(MenubuttonTest, unittest.TestCase):

    def create(self, default='b', values=('a', 'b', 'c'), **kwargs):
        return tkinter.OptionMenu(self.root, None, default, *values, **kwargs)


@add_standard_options(IntegerSizeTests, StandardOptionsTests)
class EntryTest(AbstractWidgetTest, unittest.TestCase):
    OPTIONS = (
        'background', 'borderwidth', 'cursor',
        'disabledbackground', 'disabledforeground',
        'exportselection', 'font', 'foreground',
        'highlightbackground', 'highlightcolor', 'highlightthickness',
        'insertbackground', 'insertborderwidth',
        'insertofftime', 'insertontime', 'insertwidth',
        'invalidcommand', 'justify', 'readonlybackground', 'relief',
        'selectbackground', 'selectborderwidth', 'selectforeground',
        'show', 'state', 'takefocus', 'textvariable',
        'validate', 'validatecommand', 'width', 'xscrollcommand',
    )

    def create(self, **kwargs):
        return tkinter.Entry(self.root, **kwargs)

    def test_disabledbackground(self):
        widget = self.create()
        self.checkColorParam(widget, 'disabledbackground')

    def test_insertborderwidth(self):
        widget = self.create(insertwidth=100)
        self.checkPixelsParam(widget, 'insertborderwidth',
                              0, 1.3, 2.6, 6, -2, '10p')
        # insertborderwidth is bounded above by a half of insertwidth.
        self.checkParam(widget, 'insertborderwidth', 60, expected=100//2)

    def test_insertwidth(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'insertwidth', 1.3, 3.6, '10p')
        self.checkParam(widget, 'insertwidth', 0.1, expected=2)
        self.checkParam(widget, 'insertwidth', -2, expected=2)
        if pixels_round(0.9) <= 0:
            self.checkParam(widget, 'insertwidth', 0.9, expected=2)
        else:
            self.checkParam(widget, 'insertwidth', 0.9, expected=1)

    def test_invalidcommand(self):
        widget = self.create()
        self.checkCommandParam(widget, 'invalidcommand')
        self.checkCommandParam(widget, 'invcmd')

    def test_readonlybackground(self):
        widget = self.create()
        self.checkColorParam(widget, 'readonlybackground')

    def test_show(self):
        widget = self.create()
        self.checkParam(widget, 'show', '*')
        self.checkParam(widget, 'show', '')
        self.checkParam(widget, 'show', ' ')

    def test_state(self):
        widget = self.create()
        self.checkEnumParam(widget, 'state',
                            'disabled', 'normal', 'readonly')

    def test_validate(self):
        widget = self.create()
        self.checkEnumParam(widget, 'validate',
                'all', 'key', 'focus', 'focusin', 'focusout', 'none')

    def test_validatecommand(self):
        widget = self.create()
        self.checkCommandParam(widget, 'validatecommand')
        self.checkCommandParam(widget, 'vcmd')


@add_standard_options(StandardOptionsTests)
class SpinboxTest(EntryTest, unittest.TestCase):
    OPTIONS = (
        'activebackground', 'background', 'borderwidth',
        'buttonbackground', 'buttoncursor', 'buttondownrelief', 'buttonuprelief',
        'command', 'cursor', 'disabledbackground', 'disabledforeground',
        'exportselection', 'font', 'foreground', 'format', 'from',
        'highlightbackground', 'highlightcolor', 'highlightthickness',
        'increment',
        'insertbackground', 'insertborderwidth',
        'insertofftime', 'insertontime', 'insertwidth',
        'invalidcommand', 'justify', 'relief', 'readonlybackground',
        'repeatdelay', 'repeatinterval',
        'selectbackground', 'selectborderwidth', 'selectforeground',
        'state', 'takefocus', 'textvariable', 'to',
        'validate', 'validatecommand', 'values',
        'width', 'wrap', 'xscrollcommand',
    )

    def create(self, **kwargs):
        return tkinter.Spinbox(self.root, **kwargs)

    test_show = None

    def test_buttonbackground(self):
        widget = self.create()
        self.checkColorParam(widget, 'buttonbackground')

    def test_buttoncursor(self):
        widget = self.create()
        self.checkCursorParam(widget, 'buttoncursor')

    def test_buttondownrelief(self):
        widget = self.create()
        self.checkReliefParam(widget, 'buttondownrelief')

    def test_buttonuprelief(self):
        widget = self.create()
        self.checkReliefParam(widget, 'buttonuprelief')

    def test_format(self):
        widget = self.create()
        self.checkParam(widget, 'format', '%2f')
        self.checkParam(widget, 'format', '%2.2f')
        self.checkParam(widget, 'format', '%.2f')
        self.checkParam(widget, 'format', '%2.f')
        self.checkInvalidParam(widget, 'format', '%2e-1f')
        self.checkInvalidParam(widget, 'format', '2.2')
        self.checkInvalidParam(widget, 'format', '%2.-2f')
        self.checkParam(widget, 'format', '%-2.02f')
        self.checkParam(widget, 'format', '% 2.02f')
        self.checkParam(widget, 'format', '% -2.200f')
        self.checkParam(widget, 'format', '%09.200f')
        self.checkInvalidParam(widget, 'format', '%d')

    def test_from(self):
        widget = self.create()
        self.checkParam(widget, 'to', 100.0)
        self.checkFloatParam(widget, 'from', -10, 10.2, 11.7)
        self.checkInvalidParam(widget, 'from', 200,
                errmsg='-to value must be greater than -from value')

    def test_increment(self):
        widget = self.create()
        self.checkFloatParam(widget, 'increment', -1, 1, 10.2, 12.8, 0)

    def test_to(self):
        widget = self.create()
        self.checkParam(widget, 'from', -100.0)
        self.checkFloatParam(widget, 'to', -10, 10.2, 11.7)
        self.checkInvalidParam(widget, 'to', -200,
                errmsg='-to value must be greater than -from value')

    def test_values(self):
        # XXX
        widget = self.create()
        self.assertEqual(widget['values'], '')
        self.checkParam(widget, 'values', 'mon tue wed thur')
        self.checkParam(widget, 'values', ('mon', 'tue', 'wed', 'thur'),
                        expected='mon tue wed thur')
        self.checkParam(widget, 'values', (42, 3.14, '', 'any string'),
                        expected='42 3.14 {} {any string}')
        self.checkParam(widget, 'values', '')

    def test_wrap(self):
        widget = self.create()
        self.checkBooleanParam(widget, 'wrap')

    def test_bbox(self):
        widget = self.create()
        self.assertIsBoundingBox(widget.bbox(0))
        self.assertRaises(tkinter.TclError, widget.bbox, 'noindex')
        self.assertRaises(tkinter.TclError, widget.bbox, None)
        self.assertRaises(TypeError, widget.bbox)
        self.assertRaises(TypeError, widget.bbox, 0, 1)

    def test_selection_element(self):
        widget = self.create()
        self.assertEqual(widget.selection_element(), "none")
        widget.selection_element("buttonup")
        self.assertEqual(widget.selection_element(), "buttonup")
        widget.selection_element("buttondown")
        self.assertEqual(widget.selection_element(), "buttondown")


@add_standard_options(StandardOptionsTests)
class TextTest(AbstractWidgetTest, unittest.TestCase):
    OPTIONS = (
        'autoseparators', 'background', 'blockcursor', 'borderwidth',
        'cursor', 'endline', 'exportselection',
        'font', 'foreground', 'height',
        'highlightbackground', 'highlightcolor', 'highlightthickness',
        'inactiveselectbackground', 'insertbackground', 'insertborderwidth',
        'insertofftime', 'insertontime', 'insertunfocussed', 'insertwidth',
        'maxundo', 'padx', 'pady', 'relief',
        'selectbackground', 'selectborderwidth', 'selectforeground',
        'setgrid', 'spacing1', 'spacing2', 'spacing3', 'startline', 'state',
        'tabs', 'tabstyle', 'takefocus', 'undo', 'width', 'wrap',
        'xscrollcommand', 'yscrollcommand',
    )
    if tcl_version < (8, 5):
        _stringify = True

    def create(self, **kwargs):
        return tkinter.Text(self.root, **kwargs)

    def test_autoseparators(self):
        widget = self.create()
        self.checkBooleanParam(widget, 'autoseparators')

    @requires_tcl(8, 5)
    def test_blockcursor(self):
        widget = self.create()
        self.checkBooleanParam(widget, 'blockcursor')

    @requires_tcl(8, 5)
    def test_endline(self):
        widget = self.create()
        text = '\n'.join('Line %d' for i in range(100))
        widget.insert('end', text)
        self.checkParam(widget, 'endline', 200, expected='')
        self.checkParam(widget, 'endline', -10, expected='')
        self.checkInvalidParam(widget, 'endline', 'spam',
                errmsg='expected integer but got "spam"')
        self.checkParam(widget, 'endline', 50)
        self.checkParam(widget, 'startline', 15)
        self.checkInvalidParam(widget, 'endline', 10,
                errmsg='-startline must be less than or equal to -endline')

    def test_height(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'height', 100, 101.2, 102.6, '3c')
        self.checkParam(widget, 'height', -100, expected=1)
        self.checkParam(widget, 'height', 0, expected=1)

    def test_maxundo(self):
        widget = self.create()
        self.checkIntegerParam(widget, 'maxundo', 0, 5, -1)

    @requires_tcl(8, 5)
    def test_inactiveselectbackground(self):
        widget = self.create()
        self.checkColorParam(widget, 'inactiveselectbackground')

    @requires_tcl(8, 6)
    def test_insertunfocussed(self):
        widget = self.create()
        self.checkEnumParam(widget, 'insertunfocussed',
                            'hollow', 'none', 'solid')

    def test_selectborderwidth(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'selectborderwidth',
                              1.3, 2.6, -2, '10p', conv=noconv,
                              keep_orig=tcl_version >= (8, 5))

    def test_spacing1(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'spacing1', 20, 21.4, 22.6, '0.5c')
        self.checkParam(widget, 'spacing1', -5, expected=0)

    def test_spacing2(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'spacing2', 5, 6.4, 7.6, '0.1c')
        self.checkParam(widget, 'spacing2', -1, expected=0)

    def test_spacing3(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'spacing3', 20, 21.4, 22.6, '0.5c')
        self.checkParam(widget, 'spacing3', -10, expected=0)

    @requires_tcl(8, 5)
    def test_startline(self):
        widget = self.create()
        text = '\n'.join('Line %d' for i in range(100))
        widget.insert('end', text)
        self.checkParam(widget, 'startline', 200, expected='')
        self.checkParam(widget, 'startline', -10, expected='')
        self.checkInvalidParam(widget, 'startline', 'spam',
                errmsg='expected integer but got "spam"')
        self.checkParam(widget, 'startline', 10)
        self.checkParam(widget, 'endline', 50)
        self.checkInvalidParam(widget, 'startline', 70,
                errmsg='-startline must be less than or equal to -endline')

    def test_state(self):
        widget = self.create()
        if tcl_version < (8, 5):
            self.checkParams(widget, 'state', 'disabled', 'normal')
        else:
            self.checkEnumParam(widget, 'state', 'disabled', 'normal')

    def test_tabs(self):
        widget = self.create()
        if get_tk_patchlevel() < (8, 5, 11):
            self.checkParam(widget, 'tabs', (10.2, 20.7, '1i', '2i'),
                            expected=('10.2', '20.7', '1i', '2i'))
        else:
            self.checkParam(widget, 'tabs', (10.2, 20.7, '1i', '2i'))
        self.checkParam(widget, 'tabs', '10.2 20.7 1i 2i',
                        expected=('10.2', '20.7', '1i', '2i'))
        self.checkParam(widget, 'tabs', '2c left 4c 6c center',
                        expected=('2c', 'left', '4c', '6c', 'center'))
        self.checkInvalidParam(widget, 'tabs', 'spam',
                               errmsg='bad screen distance "spam"',
                               keep_orig=tcl_version >= (8, 5))

    @requires_tcl(8, 5)
    def test_tabstyle(self):
        widget = self.create()
        self.checkEnumParam(widget, 'tabstyle', 'tabular', 'wordprocessor')

    def test_undo(self):
        widget = self.create()
        self.checkBooleanParam(widget, 'undo')

    def test_width(self):
        widget = self.create()
        self.checkIntegerParam(widget, 'width', 402)
        self.checkParam(widget, 'width', -402, expected=1)
        self.checkParam(widget, 'width', 0, expected=1)

    def test_wrap(self):
        widget = self.create()
        if tcl_version < (8, 5):
            self.checkParams(widget, 'wrap', 'char', 'none', 'word')
        else:
            self.checkEnumParam(widget, 'wrap', 'char', 'none', 'word')

    def test_bbox(self):
        widget = self.create()
        self.assertIsBoundingBox(widget.bbox('1.1'))
        self.assertIsNone(widget.bbox('end'))
        self.assertRaises(tkinter.TclError, widget.bbox, 'noindex')
        self.assertRaises(tkinter.TclError, widget.bbox, None)
        self.assertRaises(tkinter.TclError, widget.bbox)
        self.assertRaises(tkinter.TclError, widget.bbox, '1.1', 'end')


@add_standard_options(PixelSizeTests, StandardOptionsTests)
class CanvasTest(AbstractWidgetTest, unittest.TestCase):
    OPTIONS = (
        'background', 'borderwidth',
        'closeenough', 'confine', 'cursor', 'height',
        'highlightbackground', 'highlightcolor', 'highlightthickness',
        'insertbackground', 'insertborderwidth',
        'insertofftime', 'insertontime', 'insertwidth',
        'offset', 'relief', 'scrollregion',
        'selectbackground', 'selectborderwidth', 'selectforeground',
        'state', 'takefocus',
        'xscrollcommand', 'xscrollincrement',
        'yscrollcommand', 'yscrollincrement', 'width',
    )

    _conv_pixels = staticmethod(int_round)
    _stringify = True

    def create(self, **kwargs):
        return tkinter.Canvas(self.root, **kwargs)

    def test_closeenough(self):
        widget = self.create()
        self.checkFloatParam(widget, 'closeenough', 24, 2.4, 3.6, -3,
                             conv=float)

    def test_confine(self):
        widget = self.create()
        self.checkBooleanParam(widget, 'confine')

    def test_offset(self):
        widget = self.create()
        self.assertEqual(widget['offset'], '0,0')
        self.checkParams(widget, 'offset',
                'n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw', 'center')
        self.checkParam(widget, 'offset', '10,20')
        self.checkParam(widget, 'offset', '#5,6')
        self.checkInvalidParam(widget, 'offset', 'spam')

    def test_scrollregion(self):
        widget = self.create()
        self.checkParam(widget, 'scrollregion', '0 0 200 150')
        self.checkParam(widget, 'scrollregion', (0, 0, 200, 150),
                        expected='0 0 200 150')
        self.checkParam(widget, 'scrollregion', '')
        self.checkInvalidParam(widget, 'scrollregion', 'spam',
                               errmsg='bad scrollRegion "spam"')
        self.checkInvalidParam(widget, 'scrollregion', (0, 0, 200, 'spam'))
        self.checkInvalidParam(widget, 'scrollregion', (0, 0, 200))
        self.checkInvalidParam(widget, 'scrollregion', (0, 0, 200, 150, 0))

    def test_state(self):
        widget = self.create()
        self.checkEnumParam(widget, 'state', 'disabled', 'normal',
                errmsg='bad state value "{}": must be normal or disabled')

    def test_xscrollincrement(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'xscrollincrement',
                              40, 0, 41.2, 43.6, -40, '0.5i')

    def test_yscrollincrement(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'yscrollincrement',
                              10, 0, 11.2, 13.6, -10, '0.1i')


@add_standard_options(IntegerSizeTests, StandardOptionsTests)
class ListboxTest(AbstractWidgetTest, unittest.TestCase):
    OPTIONS = (
        'activestyle', 'background', 'borderwidth', 'cursor',
        'disabledforeground', 'exportselection',
        'font', 'foreground', 'height',
        'highlightbackground', 'highlightcolor', 'highlightthickness',
        'justify', 'listvariable', 'relief',
        'selectbackground', 'selectborderwidth', 'selectforeground',
        'selectmode', 'setgrid', 'state',
        'takefocus', 'width', 'xscrollcommand', 'yscrollcommand',
    )

    def create(self, **kwargs):
        return tkinter.Listbox(self.root, **kwargs)

    def test_activestyle(self):
        widget = self.create()
        self.checkEnumParam(widget, 'activestyle',
                            'dotbox', 'none', 'underline')

    test_justify = requires_tcl(8, 6, 5)(StandardOptionsTests.test_justify.im_func)

    def test_listvariable(self):
        widget = self.create()
        var = tkinter.DoubleVar(self.root)
        self.checkVariableParam(widget, 'listvariable', var)

    def test_selectmode(self):
        widget = self.create()
        self.checkParam(widget, 'selectmode', 'single')
        self.checkParam(widget, 'selectmode', 'browse')
        self.checkParam(widget, 'selectmode', 'multiple')
        self.checkParam(widget, 'selectmode', 'extended')

    def test_state(self):
        widget = self.create()
        self.checkEnumParam(widget, 'state', 'disabled', 'normal')

    def test_itemconfigure(self):
        widget = self.create()
        with self.assertRaisesRegexp(TclError, 'item number "0" out of range'):
            widget.itemconfigure(0)
        colors = 'red orange yellow green blue white violet'.split()
        widget.insert('end', *colors)
        for i, color in enumerate(colors):
            widget.itemconfigure(i, background=color)
        with self.assertRaises(TypeError):
            widget.itemconfigure()
        with self.assertRaisesRegexp(TclError, 'bad listbox index "red"'):
            widget.itemconfigure('red')
        self.assertEqual(widget.itemconfigure(0, 'background'),
                         ('background', 'background', 'Background', '', 'red'))
        self.assertEqual(widget.itemconfigure('end', 'background'),
                         ('background', 'background', 'Background', '', 'violet'))
        self.assertEqual(widget.itemconfigure('@0,0', 'background'),
                         ('background', 'background', 'Background', '', 'red'))

        d = widget.itemconfigure(0)
        self.assertIsInstance(d, dict)
        for k, v in d.items():
            self.assertIn(len(v), (2, 5))
            if len(v) == 5:
                self.assertEqual(v, widget.itemconfigure(0, k))
                self.assertEqual(v[4], widget.itemcget(0, k))

    def check_itemconfigure(self, name, value):
        widget = self.create()
        widget.insert('end', 'a', 'b', 'c', 'd')
        widget.itemconfigure(0, **{name: value})
        self.assertEqual(widget.itemconfigure(0, name)[4], value)
        self.assertEqual(widget.itemcget(0, name), value)
        with self.assertRaisesRegexp(TclError, 'unknown color name "spam"'):
            widget.itemconfigure(0, **{name: 'spam'})

    def test_itemconfigure_background(self):
        self.check_itemconfigure('background', '#ff0000')

    def test_itemconfigure_bg(self):
        self.check_itemconfigure('bg', '#ff0000')

    def test_itemconfigure_fg(self):
        self.check_itemconfigure('fg', '#110022')

    def test_itemconfigure_foreground(self):
        self.check_itemconfigure('foreground', '#110022')

    def test_itemconfigure_selectbackground(self):
        self.check_itemconfigure('selectbackground', '#110022')

    def test_itemconfigure_selectforeground(self):
        self.check_itemconfigure('selectforeground', '#654321')

    def test_box(self):
        lb = self.create()
        lb.insert(0, *('el%d' % i for i in range(8)))
        lb.pack()
        self.assertIsBoundingBox(lb.bbox(0))
        self.assertIsNone(lb.bbox(-1))
        self.assertIsNone(lb.bbox(10))
        self.assertRaises(TclError, lb.bbox, 'noindex')
        self.assertRaises(TclError, lb.bbox, None)
        self.assertRaises(TypeError, lb.bbox)
        self.assertRaises(TypeError, lb.bbox, 0, 1)

    def test_curselection(self):
        lb = self.create()
        lb.insert(0, *('el%d' % i for i in range(8)))
        lb.selection_clear(0, tkinter.END)
        lb.selection_set(2, 4)
        lb.selection_set(6)
        self.assertEqual(lb.curselection(), (2, 3, 4, 6))
        self.assertRaises(TypeError, lb.curselection, 0)

    def test_get(self):
        lb = self.create()
        lb.insert(0, *('el%d' % i for i in range(8)))
        self.assertEqual(lb.get(0), 'el0')
        self.assertEqual(lb.get(3), 'el3')
        self.assertEqual(lb.get('end'), 'el7')
        self.assertEqual(lb.get(8), '')
        self.assertEqual(lb.get(-1), '')
        self.assertEqual(lb.get(3, 5), ('el3', 'el4', 'el5'))
        self.assertEqual(lb.get(5, 'end'), ('el5', 'el6', 'el7'))
        self.assertEqual(lb.get(5, 0), ())
        self.assertEqual(lb.get(0, 0), ('el0',))
        self.assertRaises(TclError, lb.get, 'noindex')
        self.assertRaises(TclError, lb.get, None)
        self.assertRaises(TypeError, lb.get)
        self.assertRaises(TclError, lb.get, 'end', 'noindex')
        self.assertRaises(TypeError, lb.get, 1, 2, 3)
        self.assertRaises(TclError, lb.get, 2.4)


@add_standard_options(PixelSizeTests, StandardOptionsTests)
class ScaleTest(AbstractWidgetTest, unittest.TestCase):
    OPTIONS = (
        'activebackground', 'background', 'bigincrement', 'borderwidth',
        'command', 'cursor', 'digits', 'font', 'foreground', 'from',
        'highlightbackground', 'highlightcolor', 'highlightthickness',
        'label', 'length', 'orient', 'relief',
        'repeatdelay', 'repeatinterval',
        'resolution', 'showvalue', 'sliderlength', 'sliderrelief', 'state',
        'takefocus', 'tickinterval', 'to', 'troughcolor', 'variable', 'width',
    )
    default_orient = 'vertical'

    def create(self, **kwargs):
        return tkinter.Scale(self.root, **kwargs)

    def test_bigincrement(self):
        widget = self.create()
        self.checkFloatParam(widget, 'bigincrement', 12.4, 23.6, -5)

    def test_digits(self):
        widget = self.create()
        self.checkIntegerParam(widget, 'digits', 5, 0)

    def test_from(self):
        widget = self.create()
        self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=round)

    def test_label(self):
        widget = self.create()
        self.checkParam(widget, 'label', 'any string')
        self.checkParam(widget, 'label', '')

    def test_length(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'length', 130, 131.2, 135.6, '5i')

    def test_resolution(self):
        widget = self.create()
        self.checkFloatParam(widget, 'resolution', 4.2, 0, 6.7, -2)

    def test_showvalue(self):
        widget = self.create()
        self.checkBooleanParam(widget, 'showvalue')

    def test_sliderlength(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'sliderlength',
                              10, 11.2, 15.6, -3, '3m')

    def test_sliderrelief(self):
        widget = self.create()
        self.checkReliefParam(widget, 'sliderrelief')

    def test_tickinterval(self):
        widget = self.create()
        self.checkFloatParam(widget, 'tickinterval', 1, 4.3, 7.6, 0,
                             conv=round)
        self.checkParam(widget, 'tickinterval', -2, expected=2,
                        conv=round)

    def test_to(self):
        widget = self.create()
        self.checkFloatParam(widget, 'to', 300, 14.9, 15.1, -10,
                             conv=round)


@add_standard_options(PixelSizeTests, StandardOptionsTests)
class ScrollbarTest(AbstractWidgetTest, unittest.TestCase):
    OPTIONS = (
        'activebackground', 'activerelief',
        'background', 'borderwidth',
        'command', 'cursor', 'elementborderwidth',
        'highlightbackground', 'highlightcolor', 'highlightthickness',
        'jump', 'orient', 'relief',
        'repeatdelay', 'repeatinterval',
        'takefocus', 'troughcolor', 'width',
    )
    _conv_pixels = staticmethod(int_round)
    _stringify = True
    default_orient = 'vertical'

    def create(self, **kwargs):
        return tkinter.Scrollbar(self.root, **kwargs)

    def test_activerelief(self):
        widget = self.create()
        self.checkReliefParam(widget, 'activerelief')

    def test_elementborderwidth(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'elementborderwidth', 4.3, 5.6, -2, '1m')

    def test_orient(self):
        widget = self.create()
        self.checkEnumParam(widget, 'orient', 'vertical', 'horizontal',
                errmsg='bad orientation "{}": must be vertical or horizontal')

    def test_activate(self):
        sb = self.create()
        for e in ('arrow1', 'slider', 'arrow2'):
            sb.activate(e)
        sb.activate('')
        self.assertRaises(TypeError, sb.activate)
        self.assertRaises(TypeError, sb.activate, 'arrow1', 'arrow2')

    def test_set(self):
        sb = self.create()
        sb.set(0.2, 0.4)
        self.assertEqual(sb.get(), (0.2, 0.4))
        self.assertRaises(TclError, sb.set, 'abc', 'def')
        self.assertRaises(TclError, sb.set, 0.6, 'def')
        self.assertRaises(TclError, sb.set, 0.6, None)
        self.assertRaises(TclError, sb.set, 0.6)
        self.assertRaises(TclError, sb.set, 0.6, 0.7, 0.8)


@add_standard_options(StandardOptionsTests)
class PanedWindowTest(AbstractWidgetTest, unittest.TestCase):
    OPTIONS = (
        'background', 'borderwidth', 'cursor',
        'handlepad', 'handlesize', 'height',
        'opaqueresize', 'orient',
        'proxybackground', 'proxyborderwidth', 'proxyrelief',
        'relief',
        'sashcursor', 'sashpad', 'sashrelief', 'sashwidth',
        'showhandle', 'width',
    )
    default_orient = 'horizontal'

    def create(self, **kwargs):
        return tkinter.PanedWindow(self.root, **kwargs)

    def test_handlepad(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'handlepad', 5, 6.4, 7.6, -3, '1m')

    def test_handlesize(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'handlesize', 8, 9.4, 10.6, -3, '2m',
                              conv=noconv)

    def test_height(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'height', 100, 101.2, 102.6, -100, 0, '1i',
                              conv=noconv)

    def test_opaqueresize(self):
        widget = self.create()
        self.checkBooleanParam(widget, 'opaqueresize')

    @requires_tcl(8, 6, 5)
    def test_proxybackground(self):
        widget = self.create()
        self.checkColorParam(widget, 'proxybackground')

    @requires_tcl(8, 6, 5)
    def test_proxyborderwidth(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'proxyborderwidth',
                              0, 1.3, 2.9, 6, -2, '10p',
                              conv=noconv)

    @requires_tcl(8, 6, 5)
    def test_proxyrelief(self):
        widget = self.create()
        self.checkReliefParam(widget, 'proxyrelief')

    def test_sashcursor(self):
        widget = self.create()
        self.checkCursorParam(widget, 'sashcursor')

    def test_sashpad(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'sashpad', 8, 1.3, 2.6, -2, '2m')

    def test_sashrelief(self):
        widget = self.create()
        self.checkReliefParam(widget, 'sashrelief')

    def test_sashwidth(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'sashwidth', 10, 11.1, 15.6, -3, '1m',
                              conv=noconv)

    def test_showhandle(self):
        widget = self.create()
        self.checkBooleanParam(widget, 'showhandle')

    def test_width(self):
        widget = self.create()
        self.checkPixelsParam(widget, 'width', 402, 403.4, 404.6, -402, 0, '5i',
                              conv=noconv)

    def create2(self):
        p = self.create()
        b = tkinter.Button(p)
        c = tkinter.Button(p)
        p.add(b)
        p.add(c)
        return p, b, c

    def test_paneconfigure(self):
        p, b, c = self.create2()
        self.assertRaises(TypeError, p.paneconfigure)
        d = p.paneconfigure(b)
        self.assertIsInstance(d, dict)
        for k, v in d.items():
            self.assertEqual(len(v), 5)
            self.assertEqual(v, p.paneconfigure(b, k))
            self.assertEqual(v[4], p.panecget(b, k))

    def check_paneconfigure(self, p, b, name, value, expected, stringify=False):
        conv = lambda x: x
        if not self.wantobjects or stringify:
            expected = str(expected)
        if self.wantobjects and stringify:
            conv = str
        p.paneconfigure(b, **{name: value})
        self.assertEqual(conv(p.paneconfigure(b, name)[4]), expected)
        self.assertEqual(conv(p.panecget(b, name)), expected)

    def check_paneconfigure_bad(self, p, b, name, msg):
        with self.assertRaisesRegexp(TclError, msg):
            p.paneconfigure(b, **{name: 'badValue'})

    def test_paneconfigure_after(self):
        p, b, c = self.create2()
        self.check_paneconfigure(p, b, 'after', c, str(c))
        self.check_paneconfigure_bad(p, b, 'after',
                                     'bad window path name "badValue"')

    def test_paneconfigure_before(self):
        p, b, c = self.create2()
        self.check_paneconfigure(p, b, 'before', c, str(c))
        self.check_paneconfigure_bad(p, b, 'before',
                                     'bad window path name "badValue"')

    def test_paneconfigure_height(self):
        p, b, c = self.create2()
        self.check_paneconfigure(p, b, 'height', 10, 10,
                                 stringify=get_tk_patchlevel() < (8, 5, 11))
        self.check_paneconfigure_bad(p, b, 'height',
                                     'bad screen distance "badValue"')

    @requires_tcl(8, 5)
    def test_paneconfigure_hide(self):
        p, b, c = self.create2()
        self.check_paneconfigure(p, b, 'hide', False, 0)
        self.check_paneconfigure_bad(p, b, 'hide',
                                     'expected boolean value but got "badValue"')

    def test_paneconfigure_minsize(self):
        p, b, c = self.create2()
        self.check_paneconfigure(p, b, 'minsize', 10, 10)
        self.check_paneconfigure_bad(p, b, 'minsize',
                                     'bad screen distance "badValue"')

    def test_paneconfigure_padx(self):
        p, b, c = self.create2()
        self.check_paneconfigure(p, b, 'padx', 1.3, 1)
        self.check_paneconfigure_bad(p, b, 'padx',
                                     'bad screen distance "badValue"')

    def test_paneconfigure_pady(self):
        p, b, c = self.create2()
        self.check_paneconfigure(p, b, 'pady', 1.3, 1)
        self.check_paneconfigure_bad(p, b, 'pady',
                                     'bad screen distance "badValue"')

    def test_paneconfigure_sticky(self):
        p, b, c = self.create2()
        self.check_paneconfigure(p, b, 'sticky', 'nsew', 'nesw')
        self.check_paneconfigure_bad(p, b, 'sticky',
                                     'bad stickyness value "badValue": must '
                                     'be a string containing zero or more of '
                                     'n, e, s, and w')

    @requires_tcl(8, 5)
    def test_paneconfigure_stretch(self):
        p, b, c = self.create2()
        self.check_paneconfigure(p, b, 'stretch', 'alw', 'always')
        self.check_paneconfigure_bad(p, b, 'stretch',
                                     'bad stretch "badValue": must be '
                                     'always, first, last, middle, or never')

    def test_paneconfigure_width(self):
        p, b, c = self.create2()
        self.check_paneconfigure(p, b, 'width', 10, 10,
                                 stringify=get_tk_patchlevel() < (8, 5, 11))
        self.check_paneconfigure_bad(p, b, 'width',
                                     'bad screen distance "badValue"')


@add_standard_options(StandardOptionsTests)
class MenuTest(AbstractWidgetTest, unittest.TestCase):
    OPTIONS = (
        'activebackground', 'activeborderwidth', 'activeforeground',
        'background', 'borderwidth', 'cursor',
        'disabledforeground', 'font', 'foreground',
        'postcommand', 'relief', 'selectcolor', 'takefocus',
        'tearoff', 'tearoffcommand', 'title', 'type',
    )
    _conv_pixels = noconv_meth

    def create(self, **kwargs):
        return tkinter.Menu(self.root, **kwargs)

    def test_postcommand(self):
        widget = self.create()
        self.checkCommandParam(widget, 'postcommand')

    def test_tearoff(self):
        widget = self.create()
        self.checkBooleanParam(widget, 'tearoff')

    def test_tearoffcommand(self):
        widget = self.create()
        self.checkCommandParam(widget, 'tearoffcommand')

    def test_title(self):
        widget = self.create()
        self.checkParam(widget, 'title', 'any string')

    def test_type(self):
        widget = self.create()
        self.checkEnumParam(widget, 'type',
                'normal', 'tearoff', 'menubar')

    def test_entryconfigure(self):
        m1 = self.create()
        m1.add_command(label='test')
        self.assertRaises(TypeError, m1.entryconfigure)
        with self.assertRaisesRegexp(TclError, 'bad menu entry index "foo"'):
            m1.entryconfigure('foo')
        d = m1.entryconfigure(1)
        self.assertIsInstance(d, dict)
        for k, v in d.items():
            self.assertIsInstance(k, str)
            self.assertIsInstance(v, tuple)
            self.assertEqual(len(v), 5)
            self.assertEqual(v[0], k)
            self.assertEqual(m1.entrycget(1, k), v[4])
        m1.destroy()

    def test_entryconfigure_label(self):
        m1 = self.create()
        m1.add_command(label='test')
        self.assertEqual(m1.entrycget(1, 'label'), 'test')
        m1.entryconfigure(1, label='changed')
        self.assertEqual(m1.entrycget(1, 'label'), 'changed')

    def test_entryconfigure_variable(self):
        m1 = self.create()
        v1 = tkinter.BooleanVar(self.root)
        v2 = tkinter.BooleanVar(self.root)
        m1.add_checkbutton(variable=v1, onvalue=True, offvalue=False,
                           label='Nonsense')
        self.assertEqual(str(m1.entrycget(1, 'variable')), str(v1))
        m1.entryconfigure(1, variable=v2)
        self.assertEqual(str(m1.entrycget(1, 'variable')), str(v2))


@add_standard_options(PixelSizeTests, StandardOptionsTests)
class MessageTest(AbstractWidgetTest, unittest.TestCase):
    OPTIONS = (
        'anchor', 'aspect', 'background', 'borderwidth',
        'cursor', 'font', 'foreground',
        'highlightbackground', 'highlightcolor', 'highlightthickness',
        'justify', 'padx', 'pady', 'relief',
        'takefocus', 'text', 'textvariable', 'width',
    )
    _conv_pad_pixels = noconv_meth

    def create(self, **kwargs):
        return tkinter.Message(self.root, **kwargs)

    def test_aspect(self):
        widget = self.create()
        self.checkIntegerParam(widget, 'aspect', 250, 0, -300)


tests_gui = [
        ButtonTest, CanvasTest, CheckbuttonTest, EntryTest,
        FrameTest, LabelFrameTest,LabelTest, ListboxTest,
        MenubuttonTest, MenuTest, MessageTest, OptionMenuTest,
        PanedWindowTest, RadiobuttonTest, ScaleTest, ScrollbarTest,
        SpinboxTest, TextTest, ToplevelTest,
]

if __name__ == '__main__':
    run_unittest(*tests_gui)
test_tkinter/__init__.py000064400000000000150351526610011366 0ustar00test_tkinter/test_text.pyc000064400000003467150351526610012041 0ustar00�
zfc@s�ddlZddlZddlmZmZddlmZed�deejfd��YZ	e	fZ
edkr�ee
�ndS(i����N(trequirestrun_unittest(tAbstractTkTesttguitTextTestcBs#eZd�Zd�Zd�ZRS(cCs,tt|�j�tj|j�|_dS(N(tsuperRtsetUpttkintertTexttrootttext(tself((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_text.pyR
scCs�|j}|j�}zJ|jd�|j|j�d�|jd�|j|j�d�Wd|j|�|j|j�|�XdS(Nii(R
tdebugtassertEqual(RR
tolddebug((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_text.pyt
test_debugs	


cCs�|j}|jtj|jdd�|jtj|jdd�|jtj|jdd�|jtj|jdd�|jdd�|j|jddd�d�|j|jd	dd�d
�dS(Ns1.0tatishi-tests-testtends1.2ttests1.3(R
tassertRaisesRtTclErrortsearchtNonetinsertR
(RR
((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_text.pyttest_searchs	(t__name__t
__module__RRR(((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_text.pyRs		t__main__(tunittesttTkinterRttest.test_supportRRttest_ttk.supportRtTestCaseRt	tests_guiR(((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_text.pyt<module>s
$	test_tkinter/test_images.py000064400000032050150351526610012145 0ustar00import unittest
import Tkinter as tkinter
import ttk
import test.test_support as support
from test_ttk.support import AbstractTkTest, requires_tcl

support.requires('gui')


class MiscTest(AbstractTkTest, unittest.TestCase):

    def test_image_types(self):
        image_types = self.root.image_types()
        self.assertIsInstance(image_types, tuple)
        self.assertIn('photo', image_types)
        self.assertIn('bitmap', image_types)

    def test_image_names(self):
        image_names = self.root.image_names()
        self.assertIsInstance(image_names, tuple)


class BitmapImageTest(AbstractTkTest, unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        AbstractTkTest.setUpClass.__func__(cls)
        cls.testfile = support.findfile('python.xbm', subdir='imghdrdata')

    def test_create_from_file(self):
        image = tkinter.BitmapImage('::img::test', master=self.root,
                                    foreground='yellow', background='blue',
                                    file=self.testfile)
        self.assertEqual(str(image), '::img::test')
        self.assertEqual(image.type(), 'bitmap')
        self.assertEqual(image.width(), 16)
        self.assertEqual(image.height(), 16)
        self.assertIn('::img::test', self.root.image_names())
        del image
        self.assertNotIn('::img::test', self.root.image_names())

    def test_create_from_data(self):
        with open(self.testfile, 'rb') as f:
            data = f.read()
        image = tkinter.BitmapImage('::img::test', master=self.root,
                                    foreground='yellow', background='blue',
                                    data=data)
        self.assertEqual(str(image), '::img::test')
        self.assertEqual(image.type(), 'bitmap')
        self.assertEqual(image.width(), 16)
        self.assertEqual(image.height(), 16)
        self.assertIn('::img::test', self.root.image_names())
        del image
        self.assertNotIn('::img::test', self.root.image_names())

    def assertEqualStrList(self, actual, expected):
        self.assertIsInstance(actual, str)
        self.assertEqual(self.root.splitlist(actual), expected)

    def test_configure_data(self):
        image = tkinter.BitmapImage('::img::test', master=self.root)
        self.assertEqual(image['data'], '-data {} {} {} {}')
        with open(self.testfile, 'rb') as f:
            data = f.read()
        image.configure(data=data)
        self.assertEqualStrList(image['data'],
                                ('-data', '', '', '', data))
        self.assertEqual(image.width(), 16)
        self.assertEqual(image.height(), 16)

        self.assertEqual(image['maskdata'], '-maskdata {} {} {} {}')
        image.configure(maskdata=data)
        self.assertEqualStrList(image['maskdata'],
                                ('-maskdata', '', '', '', data))

    def test_configure_file(self):
        image = tkinter.BitmapImage('::img::test', master=self.root)
        self.assertEqual(image['file'], '-file {} {} {} {}')
        image.configure(file=self.testfile)
        self.assertEqualStrList(image['file'],
                                ('-file', '', '', '',self.testfile))
        self.assertEqual(image.width(), 16)
        self.assertEqual(image.height(), 16)

        self.assertEqual(image['maskfile'], '-maskfile {} {} {} {}')
        image.configure(maskfile=self.testfile)
        self.assertEqualStrList(image['maskfile'],
                                ('-maskfile', '', '', '', self.testfile))

    def test_configure_background(self):
        image = tkinter.BitmapImage('::img::test', master=self.root)
        self.assertEqual(image['background'], '-background {} {} {} {}')
        image.configure(background='blue')
        self.assertEqual(image['background'], '-background {} {} {} blue')

    def test_configure_foreground(self):
        image = tkinter.BitmapImage('::img::test', master=self.root)
        self.assertEqual(image['foreground'],
                         '-foreground {} {} #000000 #000000')
        image.configure(foreground='yellow')
        self.assertEqual(image['foreground'],
                         '-foreground {} {} #000000 yellow')


class PhotoImageTest(AbstractTkTest, unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        AbstractTkTest.setUpClass.__func__(cls)
        cls.testfile = support.findfile('python.gif', subdir='imghdrdata')

    def create(self):
        return tkinter.PhotoImage('::img::test', master=self.root,
                                  file=self.testfile)

    def colorlist(self, *args):
        if tkinter.TkVersion >= 8.6 and self.wantobjects:
            return args
        else:
            return tkinter._join(args)

    def check_create_from_file(self, ext):
        testfile = support.findfile('python.' + ext, subdir='imghdrdata')
        image = tkinter.PhotoImage('::img::test', master=self.root,
                                   file=testfile)
        self.assertEqual(str(image), '::img::test')
        self.assertEqual(image.type(), 'photo')
        self.assertEqual(image.width(), 16)
        self.assertEqual(image.height(), 16)
        self.assertEqual(image['data'], '')
        self.assertEqual(image['file'], testfile)
        self.assertIn('::img::test', self.root.image_names())
        del image
        self.assertNotIn('::img::test', self.root.image_names())

    def check_create_from_data(self, ext):
        testfile = support.findfile('python.' + ext, subdir='imghdrdata')
        with open(testfile, 'rb') as f:
            data = f.read()
        image = tkinter.PhotoImage('::img::test', master=self.root,
                                   data=data)
        self.assertEqual(str(image), '::img::test')
        self.assertEqual(image.type(), 'photo')
        self.assertEqual(image.width(), 16)
        self.assertEqual(image.height(), 16)
        self.assertEqual(image['data'], data if self.wantobjects
                                        else data.decode('latin1'))
        self.assertEqual(image['file'], '')
        self.assertIn('::img::test', self.root.image_names())
        del image
        self.assertNotIn('::img::test', self.root.image_names())

    def test_create_from_ppm_file(self):
        self.check_create_from_file('ppm')

    def test_create_from_ppm_data(self):
        self.check_create_from_data('ppm')

    def test_create_from_pgm_file(self):
        self.check_create_from_file('pgm')

    def test_create_from_pgm_data(self):
        self.check_create_from_data('pgm')

    def test_create_from_gif_file(self):
        self.check_create_from_file('gif')

    def test_create_from_gif_data(self):
        self.check_create_from_data('gif')

    @requires_tcl(8, 6)
    def test_create_from_png_file(self):
        self.check_create_from_file('png')

    @requires_tcl(8, 6)
    def test_create_from_png_data(self):
        self.check_create_from_data('png')

    def test_configure_data(self):
        image = tkinter.PhotoImage('::img::test', master=self.root)
        self.assertEqual(image['data'], '')
        with open(self.testfile, 'rb') as f:
            data = f.read()
        image.configure(data=data)
        self.assertEqual(image['data'], data if self.wantobjects
                                        else data.decode('latin1'))
        self.assertEqual(image.width(), 16)
        self.assertEqual(image.height(), 16)

    def test_configure_format(self):
        image = tkinter.PhotoImage('::img::test', master=self.root)
        self.assertEqual(image['format'], '')
        image.configure(file=self.testfile, format='gif')
        self.assertEqual(image['format'], ('gif',) if self.wantobjects
                                          else 'gif')
        self.assertEqual(image.width(), 16)
        self.assertEqual(image.height(), 16)

    def test_configure_file(self):
        image = tkinter.PhotoImage('::img::test', master=self.root)
        self.assertEqual(image['file'], '')
        image.configure(file=self.testfile)
        self.assertEqual(image['file'], self.testfile)
        self.assertEqual(image.width(), 16)
        self.assertEqual(image.height(), 16)

    def test_configure_gamma(self):
        image = tkinter.PhotoImage('::img::test', master=self.root)
        self.assertEqual(image['gamma'], '1.0')
        image.configure(gamma=2.0)
        self.assertEqual(image['gamma'], '2.0')

    def test_configure_width_height(self):
        image = tkinter.PhotoImage('::img::test', master=self.root)
        self.assertEqual(image['width'], '0')
        self.assertEqual(image['height'], '0')
        image.configure(width=20)
        image.configure(height=10)
        self.assertEqual(image['width'], '20')
        self.assertEqual(image['height'], '10')
        self.assertEqual(image.width(), 20)
        self.assertEqual(image.height(), 10)

    def test_configure_palette(self):
        image = tkinter.PhotoImage('::img::test', master=self.root)
        self.assertEqual(image['palette'], '')
        image.configure(palette=256)
        self.assertEqual(image['palette'], '256')
        image.configure(palette='3/4/2')
        self.assertEqual(image['palette'], '3/4/2')

    def test_blank(self):
        image = self.create()
        image.blank()
        self.assertEqual(image.width(), 16)
        self.assertEqual(image.height(), 16)
        self.assertEqual(image.get(4, 6), self.colorlist(0, 0, 0))

    def test_copy(self):
        image = self.create()
        image2 = image.copy()
        self.assertEqual(image2.width(), 16)
        self.assertEqual(image2.height(), 16)
        self.assertEqual(image.get(4, 6), image.get(4, 6))

    def test_subsample(self):
        image = self.create()
        image2 = image.subsample(2, 3)
        self.assertEqual(image2.width(), 8)
        self.assertEqual(image2.height(), 6)
        self.assertEqual(image2.get(2, 2), image.get(4, 6))

        image2 = image.subsample(2)
        self.assertEqual(image2.width(), 8)
        self.assertEqual(image2.height(), 8)
        self.assertEqual(image2.get(2, 3), image.get(4, 6))

    def test_zoom(self):
        image = self.create()
        image2 = image.zoom(2, 3)
        self.assertEqual(image2.width(), 32)
        self.assertEqual(image2.height(), 48)
        self.assertEqual(image2.get(8, 18), image.get(4, 6))
        self.assertEqual(image2.get(9, 20), image.get(4, 6))

        image2 = image.zoom(2)
        self.assertEqual(image2.width(), 32)
        self.assertEqual(image2.height(), 32)
        self.assertEqual(image2.get(8, 12), image.get(4, 6))
        self.assertEqual(image2.get(9, 13), image.get(4, 6))

    def test_put(self):
        image = self.create()
        image.put('{red green} {blue yellow}', to=(4, 6))
        self.assertEqual(image.get(4, 6), self.colorlist(255, 0, 0))
        self.assertEqual(image.get(5, 6),
                         self.colorlist(0, 128 if tkinter.TkVersion >= 8.6
                                           else 255, 0))
        self.assertEqual(image.get(4, 7), self.colorlist(0, 0, 255))
        self.assertEqual(image.get(5, 7), self.colorlist(255, 255, 0))

        image.put((('#f00', '#00ff00'), ('#000000fff', '#ffffffff0000')))
        self.assertEqual(image.get(0, 0), self.colorlist(255, 0, 0))
        self.assertEqual(image.get(1, 0), self.colorlist(0, 255, 0))
        self.assertEqual(image.get(0, 1), self.colorlist(0, 0, 255))
        self.assertEqual(image.get(1, 1), self.colorlist(255, 255, 0))

    def test_get(self):
        image = self.create()
        self.assertEqual(image.get(4, 6), self.colorlist(62, 116, 162))
        self.assertEqual(image.get(0, 0), self.colorlist(0, 0, 0))
        self.assertEqual(image.get(15, 15), self.colorlist(0, 0, 0))
        self.assertRaises(tkinter.TclError, image.get, -1, 0)
        self.assertRaises(tkinter.TclError, image.get, 0, -1)
        self.assertRaises(tkinter.TclError, image.get, 16, 15)
        self.assertRaises(tkinter.TclError, image.get, 15, 16)

    def test_write(self):
        image = self.create()
        self.addCleanup(support.unlink, support.TESTFN)

        image.write(support.TESTFN)
        image2 = tkinter.PhotoImage('::img::test2', master=self.root,
                                    format='ppm',
                                    file=support.TESTFN)
        self.assertEqual(str(image2), '::img::test2')
        self.assertEqual(image2.type(), 'photo')
        self.assertEqual(image2.width(), 16)
        self.assertEqual(image2.height(), 16)
        self.assertEqual(image2.get(0, 0), image.get(0, 0))
        self.assertEqual(image2.get(15, 8), image.get(15, 8))

        image.write(support.TESTFN, format='gif', from_coords=(4, 6, 6, 9))
        image3 = tkinter.PhotoImage('::img::test3', master=self.root,
                                    format='gif',
                                    file=support.TESTFN)
        self.assertEqual(str(image3), '::img::test3')
        self.assertEqual(image3.type(), 'photo')
        self.assertEqual(image3.width(), 2)
        self.assertEqual(image3.height(), 3)
        self.assertEqual(image3.get(0, 0), image.get(4, 6))
        self.assertEqual(image3.get(1, 2), image.get(5, 8))


tests_gui = (MiscTest, BitmapImageTest, PhotoImageTest,)

if __name__ == "__main__":
    support.run_unittest(*tests_gui)
test_tkinter/__init__.pyo000064400000000220150351526610011551 0ustar00�
zfc@sdS(N((((s9/usr/lib64/python2.7/lib-tk/test/test_tkinter/__init__.pyt<module>ttest_tkinter/test_variables.pyo000064400000026236150351526610013040 0ustar00�
zfc@sddlZddlZddlmZmZmZmZmZmZm	Z	dej
fd��YZdefd��YZdefd��YZ
d	efd
��YZdefd��YZd
efd��YZee
eeefZedkrddlmZee�ndS(i����N(tVariablet	StringVartIntVart	DoubleVart
BooleanVartTcltTclErrortTestBasecBseZd�Zd�ZRS(cCst�|_dS(N(Rtroot(tself((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pytsetUp	scCs
|`dS(N(R(R	((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttearDowns(t__name__t
__module__R
R(((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRs	tTestVariablecBsYeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	cGs"|jj|jjdd|��S(Ntinfotexists(Rt
getbooleantcall(R	targs((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pytinfo_existsscCs?t|j�}|jd|j��|jt|�d�dS(Nts
^PY_VAR(\d+)$(RRtassertEqualtgettassertRegexpMatcheststr(R	tv((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest_defaultscCsEt|jdd�}|jd|j��|jdt|��dS(Ns
sample stringtvarname(RRRRR(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest_name_and_valuescCs^|j|jd��t|jdd�}|j|jd��~|j|jd��dS(NRs
sample string(tassertFalseRRRt
assertTrue(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest___del__s
cCsv|j|jd��t|jdd�}t|jdd�}~|j|jd��~|j|jd��dS(NRtname(RRRR(R	tv1tv2((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest_dont_unset_not_existing&scCsxt|jdd�}t|jdd�}|j||�t|jdd�}t|jdd�}|j||�dS(NR!tabc(RRRRtassertNotEqual(R	R"R#tv3tv4((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest___eq__0scCs-|jt��t|jdd�WdQXdS(NR!i{(tassertRaisest	TypeErrorRR(R	((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest_invalid_name:sc	Cs|jt��t|jdd�WdQX|jt��|jjdd�WdQX|jt��|jjdd�WdQXdS(NR!svarnametvalue(R*t
ValueErrorRRtglobalsetvartsetvar(R	((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest_null_in_name>scsot|j�}t|�}g��fd�}�fd�}|jd|�}|jd|�}|jt|j��d|fd|fg�|j�g�|jd�|j�d|ddfg�g�|j�|j�d	|ddfg�g�t|j��}|j	d|�|jt|j��|�|j
t��|j	dd�WdQX|jt|j��|�|j	d|d
f�|jt|j��|�|j�|j�d	|ddfg�g�|j	d|�|j|j�d|fg�|j�|j�g�g�~tj
�|jd�|j�d|ddfg�dS(Ncs�jd|�dS(Ntread(R2(tappend(R(ttrace(s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pytread_tracerJscs�jd|�dS(Ntwrite(R6(R3(R(R4(s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pytwrite_tracerLstrtwutspamR6RtwR2i+teggs(RRRttrace_variableRtsortedttrace_vinfotsetRt
trace_vdeleteR*Rtgctcollect(R	RtvnameR5R7tcb1tcb2R((R4s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyt
test_traceFsF.





(RR
RRRR R$R)R,R1RG(((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRs					
	
		t
TestStringVarcBs#eZd�Zd�Zd�ZRS(cCs)t|j�}|jd|j��dS(NR(RRRR(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRzscCsXt|jdd�}|jd|j��|jjdd�|jd|j��dS(NR%R!R-(RRRRR/(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest_get~scCsXt|jdd�}|jd|j��|jjdd�|jd|j��dS(NsabcdefR!svalue(RRRRR/(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyt
test_get_null�s(RR
RRIRJ(((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRHxs		t
TestIntVarcBs#eZd�Zd�Zd�ZRS(cCs)t|j�}|jd|j��dS(Ni(RRRR(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyR�scCsXt|jdd�}|jd|j��|jjdd�|jd|j��dS(Ni{R!t345iY(RRRRR/(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRI�scCst|jdd�}|jjdd�|jt��|j�WdQX|jjdd�|jt��|j�WdQXdS(NR!R-s345.0(RRR/R*R.R(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest_invalid_value�s(RR
RRIRM(((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRK�s		t
TestDoubleVarcBs,eZd�Zd�Zd�Zd�ZRS(cCs)t|j�}|jd|j��dS(Ng(RRRR(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyR�scCsXt|jdd�}|jd|j��|jjdd�|jd|j��dS(Ng�G�z��?R!s3.45g������@(RRtassertAlmostEqualRR/(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRI�scCs�t|jdd�}|jd|j��|jjdd�|jd|j��|jjdd�|jd|j��dS(Ng�G�z��?R!s3.45g������@t456i�(RRRORR/(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest_get_from_int�scCsLt|jdd�}|jjdd�|jt��|j�WdQXdS(NR!R-(RRR/R*R.R(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRM�s(RR
RRIRQRM(((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRN�s			tTestBooleanVarcBs,eZd�Zd�Zd�Zd�ZRS(cCs)t|j�}|j|j�t�dS(N(RRtassertIsRtFalse(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyR�scCs�t|jtd�}|j|j�t�|jjdd�|j|j�t�|jjd|jj�rudnd�|j|j�t�|jjdd�|j|j�t�|jjd|jj�r�dnd�|j|j�t�|jjdd�|j|j�t�|jjdd	�|j|j�t�|jjdd
�|j|j�t�|jjdd�|j|j�t�dS(NR!t0i*iil*lltonu0uon(RRtTrueRSRR/RTtwantobjects(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRI�s$((cCs�|jj�rdnd}|jj�r0dnd}t|jdd�}|jt�|j|jjd�|�|jd�|j|jjd�|�|jd�|j|jjd�|�|jd�|j|jjd�|�|jd�|j|jjd�|�|jd�|j|jjd�|�|jd	�|j|jjd�|�|jd
�|j|jjd�|�|jd�|j|jjd�|�dS(Nit1iRUR!i*l*lRVu0uon(RRXRR@RWRtglobalgetvar(R	ttruetfalseR((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest_set�s*








cCs�|jj�rdnd}t|jdd�}|jt��|jd�WdQX|j|jjd�|�|jjdd�|jt��|j	�WdQX|jjdd�|jt��|j	�WdQXdS(NiRUR!R-s1.0(
RRXRR*RR@RRZR/R(R	R\R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest_invalid_value_domain�s(RR
RRIR]R^(((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRR�s			t__main__(trun_unittest(tunittestRBtTkinterRRRRRRRtTestCaseRRRHRKRNRRt	tests_guiRttest.supportR`(((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyt<module>s4	h?	test_tkinter/test_font.pyo000064400000011672150351526610012034 0ustar00�
zfc@s�ddlZddlZddlZddlmZmZmZddl	m
Z
ed�dZde
ejfd��YZ
e
fZedkr�ee�ndS(	i����N(trequirestrun_unittestt
gc_collect(tAbstractTkTesttguit
TkDefaultFonttFontTestcBsheZed��Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�ZRS(
cCswtjj|�y(tjd|jdtdt�|_Wn8tj	k
rrtjd|jdtdt
�|_nXdS(Ntroottnametexists(Rt
setUpClasst__func__tfonttFontRtfontnametTruettkintertTclErrortFalse(tcls((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyR

s
(cCsL|jj�}|jt|�ddddddh�xI|D]A}|j|jj|�||�|j|j|||�q>WxUdD]M}|j||t�|j|jj|�t�|j|j|t�q�W|jr�t	nt}xUdD]M}|j|||�|j|jj|�|�|j|j||�q�WdS(	Ntfamilytsizetweighttslantt	underlinet
overstrike(RRR(RRR(
Rt	configuretassertGreaterEqualtsettassertEqualtcgettassertIsInstancetstrtwantobjectstint(tselftoptionstkeytsizetype((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyttest_configures
 

cCs�d}y%tjd|jd|dt�}Wn5tjk
rbtjd|jd|dt�}nX|j|jd�|�~t	�dS(NuMS ゴシックRRR	(
RR
RRRRRRRR(R#Rtf((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyttest_unicode_family&s%%cCs|jj�}|jt|�ddddddh�x.|D]&}|j|jj|�||�q>Wx>dD]6}|j||t�|j|jj|�t�qoW|jr�tnt}x>dD]6}|j|||�|j|jj|�|�q�WdS(	NRRRRRR(RRR(RRR(	RtactualRRRRR R!R"(R#R$R%R&((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyttest_actual0s
$
 
cCs3|j|jjt�|jt|j�t�dS(N(RRRRR (R#((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyt	test_name>scCs�tjd|jdtdt�}tjd|jdtdt�}|j||�|j||�|j||j��|j|d�|j	|dg�dS(NRRR	i(
RR
RRRtassertIsNotRtassertNotEqualtcopytassertNotIn(R#tfont1tfont2((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyttest_eqBs!!cCs |j|jjd�t�dS(Ntabc(RRtmeasureR"(R#((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyttest_measureKscCs�|jj�}|jt|�ddddh�x^|D]V}|j|jj|�||�|j||t�|j|jj|�t�q8WdS(Ntascenttdescentt	linespacetfixed(RtmetricsRRRRR"(R#R;R%((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyttest_metricsNs
 cCsgtj|j�}|j|t�|j|�x1|D])}|j|ttf�|j|�q6WdS(N(RtfamiliesRRttuplet
assertTrueR tunicode(R#R=R((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyt
test_familiesWs

cCswtj|j�}|j|t�|j|�x1|D])}|j|ttf�|j|�q6W|jt	|�dS(N(
RtnamesRRR>R?R R@tassertInR(R#RBR((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyt
test_names_s

(
t__name__t
__module__tclassmethodR
R'R)R+R,R3R6R<RARD(((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyRs		
								t__main__(tunittesttTkinterRttkFontRttest.test_supportRRRttest_ttk.supportRRtTestCaseRt	tests_guiRE(((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyt<module>s
]	test_tkinter/test_font.pyc000064400000011672150351526610012020 0ustar00�
zfc@s�ddlZddlZddlZddlmZmZmZddl	m
Z
ed�dZde
ejfd��YZ
e
fZedkr�ee�ndS(	i����N(trequirestrun_unittestt
gc_collect(tAbstractTkTesttguit
TkDefaultFonttFontTestcBsheZed��Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�ZRS(
cCswtjj|�y(tjd|jdtdt�|_Wn8tj	k
rrtjd|jdtdt
�|_nXdS(Ntroottnametexists(Rt
setUpClasst__func__tfonttFontRtfontnametTruettkintertTclErrortFalse(tcls((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyR

s
(cCsL|jj�}|jt|�ddddddh�xI|D]A}|j|jj|�||�|j|j|||�q>WxUdD]M}|j||t�|j|jj|�t�|j|j|t�q�W|jr�t	nt}xUdD]M}|j|||�|j|jj|�|�|j|j||�q�WdS(	Ntfamilytsizetweighttslantt	underlinet
overstrike(RRR(RRR(
Rt	configuretassertGreaterEqualtsettassertEqualtcgettassertIsInstancetstrtwantobjectstint(tselftoptionstkeytsizetype((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyttest_configures
 

cCs�d}y%tjd|jd|dt�}Wn5tjk
rbtjd|jd|dt�}nX|j|jd�|�~t	�dS(NuMS ゴシックRRR	(
RR
RRRRRRRR(R#Rtf((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyttest_unicode_family&s%%cCs|jj�}|jt|�ddddddh�x.|D]&}|j|jj|�||�q>Wx>dD]6}|j||t�|j|jj|�t�qoW|jr�tnt}x>dD]6}|j|||�|j|jj|�|�q�WdS(	NRRRRRR(RRR(RRR(	RtactualRRRRR R!R"(R#R$R%R&((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyttest_actual0s
$
 
cCs3|j|jjt�|jt|j�t�dS(N(RRRRR (R#((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyt	test_name>scCs�tjd|jdtdt�}tjd|jdtdt�}|j||�|j||�|j||j��|j|d�|j	|dg�dS(NRRR	i(
RR
RRRtassertIsNotRtassertNotEqualtcopytassertNotIn(R#tfont1tfont2((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyttest_eqBs!!cCs |j|jjd�t�dS(Ntabc(RRtmeasureR"(R#((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyttest_measureKscCs�|jj�}|jt|�ddddh�x^|D]V}|j|jj|�||�|j||t�|j|jj|�t�q8WdS(Ntascenttdescentt	linespacetfixed(RtmetricsRRRRR"(R#R;R%((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyttest_metricsNs
 cCsgtj|j�}|j|t�|j|�x1|D])}|j|ttf�|j|�q6WdS(N(RtfamiliesRRttuplet
assertTrueR tunicode(R#R=R((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyt
test_familiesWs

cCswtj|j�}|j|t�|j|�x1|D])}|j|ttf�|j|�q6W|jt	|�dS(N(
RtnamesRRR>R?R R@tassertInR(R#RBR((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyt
test_names_s

(
t__name__t
__module__tclassmethodR
R'R)R+R,R3R6R<RARD(((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyRs		
								t__main__(tunittesttTkinterRttkFontRttest.test_supportRRRttest_ttk.supportRRtTestCaseRt	tests_guiRE(((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_font.pyt<module>s
]	test_tkinter/test_text.py000064400000002674150351526610011675 0ustar00import unittest
import Tkinter as tkinter
from test.test_support import requires, run_unittest
from test_ttk.support import AbstractTkTest

requires('gui')

class TextTest(AbstractTkTest, unittest.TestCase):

    def setUp(self):
        super(TextTest, self).setUp()
        self.text = tkinter.Text(self.root)

    def test_debug(self):
        text = self.text
        olddebug = text.debug()
        try:
            text.debug(0)
            self.assertEqual(text.debug(), 0)
            text.debug(1)
            self.assertEqual(text.debug(), 1)
        finally:
            text.debug(olddebug)
            self.assertEqual(text.debug(), olddebug)

    def test_search(self):
        text = self.text

        # pattern and index are obligatory arguments.
        self.assertRaises(tkinter.TclError, text.search, None, '1.0')
        self.assertRaises(tkinter.TclError, text.search, 'a', None)
        self.assertRaises(tkinter.TclError, text.search, None, None)

        # Invalid text index.
        self.assertRaises(tkinter.TclError, text.search, '', 0)

        # Check if we are getting the indices as strings -- you are likely
        # to get Tcl_Obj under Tk 8.5 if Tkinter doesn't convert it.
        text.insert('1.0', 'hi-test')
        self.assertEqual(text.search('-test', '1.0', 'end'), '1.2')
        self.assertEqual(text.search('test', '1.0', 'end'), '1.3')


tests_gui = (TextTest, )

if __name__ == "__main__":
    run_unittest(*tests_gui)
test_tkinter/test_variables.pyc000064400000026236150351526610013024 0ustar00�
zfc@sddlZddlZddlmZmZmZmZmZmZm	Z	dej
fd��YZdefd��YZdefd��YZ
d	efd
��YZdefd��YZd
efd��YZee
eeefZedkrddlmZee�ndS(i����N(tVariablet	StringVartIntVart	DoubleVart
BooleanVartTcltTclErrortTestBasecBseZd�Zd�ZRS(cCst�|_dS(N(Rtroot(tself((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pytsetUp	scCs
|`dS(N(R(R	((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttearDowns(t__name__t
__module__R
R(((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRs	tTestVariablecBsYeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	cGs"|jj|jjdd|��S(Ntinfotexists(Rt
getbooleantcall(R	targs((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pytinfo_existsscCs?t|j�}|jd|j��|jt|�d�dS(Nts
^PY_VAR(\d+)$(RRtassertEqualtgettassertRegexpMatcheststr(R	tv((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest_defaultscCsEt|jdd�}|jd|j��|jdt|��dS(Ns
sample stringtvarname(RRRRR(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest_name_and_valuescCs^|j|jd��t|jdd�}|j|jd��~|j|jd��dS(NRs
sample string(tassertFalseRRRt
assertTrue(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest___del__s
cCsv|j|jd��t|jdd�}t|jdd�}~|j|jd��~|j|jd��dS(NRtname(RRRR(R	tv1tv2((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest_dont_unset_not_existing&scCsxt|jdd�}t|jdd�}|j||�t|jdd�}t|jdd�}|j||�dS(NR!tabc(RRRRtassertNotEqual(R	R"R#tv3tv4((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest___eq__0scCs-|jt��t|jdd�WdQXdS(NR!i{(tassertRaisest	TypeErrorRR(R	((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest_invalid_name:sc	Cs|jt��t|jdd�WdQX|jt��|jjdd�WdQX|jt��|jjdd�WdQXdS(NR!svarnametvalue(R*t
ValueErrorRRtglobalsetvartsetvar(R	((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest_null_in_name>scsot|j�}t|�}g��fd�}�fd�}|jd|�}|jd|�}|jt|j��d|fd|fg�|j�g�|jd�|j�d|ddfg�g�|j�|j�d	|ddfg�g�t|j��}|j	d|�|jt|j��|�|j
t��|j	dd�WdQX|jt|j��|�|j	d|d
f�|jt|j��|�|j�|j�d	|ddfg�g�|j	d|�|j|j�d|fg�|j�|j�g�g�~tj
�|jd�|j�d|ddfg�dS(Ncs�jd|�dS(Ntread(R2(tappend(R(ttrace(s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pytread_tracerJscs�jd|�dS(Ntwrite(R6(R3(R(R4(s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pytwrite_tracerLstrtwutspamR6RtwR2i+teggs(RRRttrace_variableRtsortedttrace_vinfotsetRt
trace_vdeleteR*Rtgctcollect(R	RtvnameR5R7tcb1tcb2R((R4s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyt
test_traceFsF.





(RR
RRRR R$R)R,R1RG(((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRs					
	
		t
TestStringVarcBs#eZd�Zd�Zd�ZRS(cCs)t|j�}|jd|j��dS(NR(RRRR(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRzscCsXt|jdd�}|jd|j��|jjdd�|jd|j��dS(NR%R!R-(RRRRR/(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest_get~scCsXt|jdd�}|jd|j��|jjdd�|jd|j��dS(NsabcdefR!svalue(RRRRR/(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyt
test_get_null�s(RR
RRIRJ(((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRHxs		t
TestIntVarcBs#eZd�Zd�Zd�ZRS(cCs)t|j�}|jd|j��dS(Ni(RRRR(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyR�scCsXt|jdd�}|jd|j��|jjdd�|jd|j��dS(Ni{R!t345iY(RRRRR/(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRI�scCst|jdd�}|jjdd�|jt��|j�WdQX|jjdd�|jt��|j�WdQXdS(NR!R-s345.0(RRR/R*R.R(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest_invalid_value�s(RR
RRIRM(((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRK�s		t
TestDoubleVarcBs,eZd�Zd�Zd�Zd�ZRS(cCs)t|j�}|jd|j��dS(Ng(RRRR(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyR�scCsXt|jdd�}|jd|j��|jjdd�|jd|j��dS(Ng�G�z��?R!s3.45g������@(RRtassertAlmostEqualRR/(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRI�scCs�t|jdd�}|jd|j��|jjdd�|jd|j��|jjdd�|jd|j��dS(Ng�G�z��?R!s3.45g������@t456i�(RRRORR/(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest_get_from_int�scCsLt|jdd�}|jjdd�|jt��|j�WdQXdS(NR!R-(RRR/R*R.R(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRM�s(RR
RRIRQRM(((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRN�s			tTestBooleanVarcBs,eZd�Zd�Zd�Zd�ZRS(cCs)t|j�}|j|j�t�dS(N(RRtassertIsRtFalse(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyR�scCs�t|jtd�}|j|j�t�|jjdd�|j|j�t�|jjd|jj�rudnd�|j|j�t�|jjdd�|j|j�t�|jjd|jj�r�dnd�|j|j�t�|jjdd�|j|j�t�|jjdd	�|j|j�t�|jjdd
�|j|j�t�|jjdd�|j|j�t�dS(NR!t0i*iil*lltonu0uon(RRtTrueRSRR/RTtwantobjects(R	R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRI�s$((cCs�|jj�rdnd}|jj�r0dnd}t|jdd�}|jt�|j|jjd�|�|jd�|j|jjd�|�|jd�|j|jjd�|�|jd�|j|jjd�|�|jd�|j|jjd�|�|jd�|j|jjd�|�|jd	�|j|jjd�|�|jd
�|j|jjd�|�|jd�|j|jjd�|�dS(Nit1iRUR!i*l*lRVu0uon(RRXRR@RWRtglobalgetvar(R	ttruetfalseR((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest_set�s*








cCs�|jj�rdnd}t|jdd�}|jt��|jd�WdQX|j|jjd�|�|jjdd�|jt��|j	�WdQX|jjdd�|jt��|j	�WdQXdS(NiRUR!R-s1.0(
RRXRR*RR@RRZR/R(R	R\R((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyttest_invalid_value_domain�s(RR
RRIR]R^(((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyRR�s			t__main__(trun_unittest(tunittestRBtTkinterRRRRRRRtTestCaseRRRHRKRNRRt	tests_guiRttest.supportR`(((s?/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_variables.pyt<module>s4	h?	test_tkinter/test_geometry_managers.py000064400000117167150351526610014425 0ustar00import unittest
import re
import Tkinter as tkinter
from Tkinter import TclError
from test.test_support import requires, run_unittest

from test_ttk.support import pixels_conv, tcl_version, requires_tcl
from widget_tests import AbstractWidgetTest, int_round

requires('gui')


class PackTest(AbstractWidgetTest, unittest.TestCase):

    test_keys = None

    def create2(self):
        pack = tkinter.Toplevel(self.root, name='pack')
        pack.wm_geometry('300x200+0+0')
        pack.wm_minsize(1, 1)
        a = tkinter.Frame(pack, name='a', width=20, height=40, bg='red')
        b = tkinter.Frame(pack, name='b', width=50, height=30, bg='blue')
        c = tkinter.Frame(pack, name='c', width=80, height=80, bg='green')
        d = tkinter.Frame(pack, name='d', width=40, height=30, bg='yellow')
        return pack, a, b, c, d

    def test_pack_configure_after(self):
        pack, a, b, c, d = self.create2()
        with self.assertRaisesRegexp(TclError, 'window "%s" isn\'t packed' % b):
            a.pack_configure(after=b)
        with self.assertRaisesRegexp(TclError, 'bad window path name ".foo"'):
            a.pack_configure(after='.foo')
        a.pack_configure(side='top')
        b.pack_configure(side='top')
        c.pack_configure(side='top')
        d.pack_configure(side='top')
        self.assertEqual(pack.pack_slaves(), [a, b, c, d])
        a.pack_configure(after=b)
        self.assertEqual(pack.pack_slaves(), [b, a, c, d])
        a.pack_configure(after=a)
        self.assertEqual(pack.pack_slaves(), [b, a, c, d])

    def test_pack_configure_anchor(self):
        pack, a, b, c, d = self.create2()
        def check(anchor, geom):
            a.pack_configure(side='top', ipadx=5, padx=10, ipady=15, pady=20,
                             expand=True, anchor=anchor)
            self.root.update()
            self.assertEqual(a.winfo_geometry(), geom)
        check('n', '30x70+135+20')
        check('ne', '30x70+260+20')
        check('e', '30x70+260+65')
        check('se', '30x70+260+110')
        check('s', '30x70+135+110')
        check('sw', '30x70+10+110')
        check('w', '30x70+10+65')
        check('nw', '30x70+10+20')
        check('center', '30x70+135+65')

    def test_pack_configure_before(self):
        pack, a, b, c, d = self.create2()
        with self.assertRaisesRegexp(TclError, 'window "%s" isn\'t packed' % b):
            a.pack_configure(before=b)
        with self.assertRaisesRegexp(TclError, 'bad window path name ".foo"'):
            a.pack_configure(before='.foo')
        a.pack_configure(side='top')
        b.pack_configure(side='top')
        c.pack_configure(side='top')
        d.pack_configure(side='top')
        self.assertEqual(pack.pack_slaves(), [a, b, c, d])
        a.pack_configure(before=d)
        self.assertEqual(pack.pack_slaves(), [b, c, a, d])
        a.pack_configure(before=a)
        self.assertEqual(pack.pack_slaves(), [b, c, a, d])

    def test_pack_configure_expand(self):
        pack, a, b, c, d = self.create2()
        def check(*geoms):
            self.root.update()
            self.assertEqual(a.winfo_geometry(), geoms[0])
            self.assertEqual(b.winfo_geometry(), geoms[1])
            self.assertEqual(c.winfo_geometry(), geoms[2])
            self.assertEqual(d.winfo_geometry(), geoms[3])
        a.pack_configure(side='left')
        b.pack_configure(side='top')
        c.pack_configure(side='right')
        d.pack_configure(side='bottom')
        check('20x40+0+80', '50x30+135+0', '80x80+220+75', '40x30+100+170')
        a.pack_configure(side='left', expand='yes')
        b.pack_configure(side='top', expand='on')
        c.pack_configure(side='right', expand=True)
        d.pack_configure(side='bottom', expand=1)
        check('20x40+40+80', '50x30+175+35', '80x80+180+110', '40x30+100+135')
        a.pack_configure(side='left', expand='yes', fill='both')
        b.pack_configure(side='top', expand='on', fill='both')
        c.pack_configure(side='right', expand=True, fill='both')
        d.pack_configure(side='bottom', expand=1, fill='both')
        check('100x200+0+0', '200x100+100+0', '160x100+140+100', '40x100+100+100')

    def test_pack_configure_in(self):
        pack, a, b, c, d = self.create2()
        a.pack_configure(side='top')
        b.pack_configure(side='top')
        c.pack_configure(side='top')
        d.pack_configure(side='top')
        a.pack_configure(in_=pack)
        self.assertEqual(pack.pack_slaves(), [b, c, d, a])
        a.pack_configure(in_=c)
        self.assertEqual(pack.pack_slaves(), [b, c, d])
        self.assertEqual(c.pack_slaves(), [a])
        with self.assertRaisesRegexp(TclError,
                                     'can\'t pack %s inside itself' % (a,)):
            a.pack_configure(in_=a)
        with self.assertRaisesRegexp(TclError, 'bad window path name ".foo"'):
            a.pack_configure(in_='.foo')

    def test_pack_configure_padx_ipadx_fill(self):
        pack, a, b, c, d = self.create2()
        def check(geom1, geom2, **kwargs):
            a.pack_forget()
            b.pack_forget()
            a.pack_configure(**kwargs)
            b.pack_configure(expand=True, fill='both')
            self.root.update()
            self.assertEqual(a.winfo_geometry(), geom1)
            self.assertEqual(b.winfo_geometry(), geom2)
        check('20x40+260+80', '240x200+0+0', side='right', padx=20)
        check('20x40+250+80', '240x200+0+0', side='right', padx=(10, 30))
        check('60x40+240+80', '240x200+0+0', side='right', ipadx=20)
        check('30x40+260+80', '250x200+0+0', side='right', ipadx=5, padx=10)
        check('20x40+260+80', '240x200+0+0', side='right', padx=20, fill='x')
        check('20x40+249+80', '240x200+0+0',
              side='right', padx=(9, 31), fill='x')
        check('60x40+240+80', '240x200+0+0', side='right', ipadx=20, fill='x')
        check('30x40+260+80', '250x200+0+0',
              side='right', ipadx=5, padx=10, fill='x')
        check('30x40+255+80', '250x200+0+0',
              side='right', ipadx=5, padx=(5, 15), fill='x')
        check('20x40+140+0', '300x160+0+40', side='top', padx=20)
        check('20x40+120+0', '300x160+0+40', side='top', padx=(0, 40))
        check('60x40+120+0', '300x160+0+40', side='top', ipadx=20)
        check('30x40+135+0', '300x160+0+40', side='top', ipadx=5, padx=10)
        check('30x40+130+0', '300x160+0+40', side='top', ipadx=5, padx=(5, 15))
        check('260x40+20+0', '300x160+0+40', side='top', padx=20, fill='x')
        check('260x40+25+0', '300x160+0+40',
              side='top', padx=(25, 15), fill='x')
        check('300x40+0+0', '300x160+0+40', side='top', ipadx=20, fill='x')
        check('280x40+10+0', '300x160+0+40',
              side='top', ipadx=5, padx=10, fill='x')
        check('280x40+5+0', '300x160+0+40',
              side='top', ipadx=5, padx=(5, 15), fill='x')
        a.pack_configure(padx='1c')
        self.assertEqual(a.pack_info()['padx'],
                         self._str(pack.winfo_pixels('1c')))
        a.pack_configure(ipadx='1c')
        self.assertEqual(a.pack_info()['ipadx'],
                         self._str(pack.winfo_pixels('1c')))

    def test_pack_configure_pady_ipady_fill(self):
        pack, a, b, c, d = self.create2()
        def check(geom1, geom2, **kwargs):
            a.pack_forget()
            b.pack_forget()
            a.pack_configure(**kwargs)
            b.pack_configure(expand=True, fill='both')
            self.root.update()
            self.assertEqual(a.winfo_geometry(), geom1)
            self.assertEqual(b.winfo_geometry(), geom2)
        check('20x40+280+80', '280x200+0+0', side='right', pady=20)
        check('20x40+280+70', '280x200+0+0', side='right', pady=(10, 30))
        check('20x80+280+60', '280x200+0+0', side='right', ipady=20)
        check('20x50+280+75', '280x200+0+0', side='right', ipady=5, pady=10)
        check('20x40+280+80', '280x200+0+0', side='right', pady=20, fill='x')
        check('20x40+280+69', '280x200+0+0',
              side='right', pady=(9, 31), fill='x')
        check('20x80+280+60', '280x200+0+0', side='right', ipady=20, fill='x')
        check('20x50+280+75', '280x200+0+0',
              side='right', ipady=5, pady=10, fill='x')
        check('20x50+280+70', '280x200+0+0',
              side='right', ipady=5, pady=(5, 15), fill='x')
        check('20x40+140+20', '300x120+0+80', side='top', pady=20)
        check('20x40+140+0', '300x120+0+80', side='top', pady=(0, 40))
        check('20x80+140+0', '300x120+0+80', side='top', ipady=20)
        check('20x50+140+10', '300x130+0+70', side='top', ipady=5, pady=10)
        check('20x50+140+5', '300x130+0+70', side='top', ipady=5, pady=(5, 15))
        check('300x40+0+20', '300x120+0+80', side='top', pady=20, fill='x')
        check('300x40+0+25', '300x120+0+80',
              side='top', pady=(25, 15), fill='x')
        check('300x80+0+0', '300x120+0+80', side='top', ipady=20, fill='x')
        check('300x50+0+10', '300x130+0+70',
              side='top', ipady=5, pady=10, fill='x')
        check('300x50+0+5', '300x130+0+70',
              side='top', ipady=5, pady=(5, 15), fill='x')
        a.pack_configure(pady='1c')
        self.assertEqual(a.pack_info()['pady'],
                         self._str(pack.winfo_pixels('1c')))
        a.pack_configure(ipady='1c')
        self.assertEqual(a.pack_info()['ipady'],
                         self._str(pack.winfo_pixels('1c')))

    def test_pack_configure_side(self):
        pack, a, b, c, d = self.create2()
        def check(side, geom1, geom2):
            a.pack_configure(side=side)
            self.assertEqual(a.pack_info()['side'], side)
            b.pack_configure(expand=True, fill='both')
            self.root.update()
            self.assertEqual(a.winfo_geometry(), geom1)
            self.assertEqual(b.winfo_geometry(), geom2)
        check('top', '20x40+140+0', '300x160+0+40')
        check('bottom', '20x40+140+160', '300x160+0+0')
        check('left', '20x40+0+80', '280x200+20+0')
        check('right', '20x40+280+80', '280x200+0+0')

    def test_pack_forget(self):
        pack, a, b, c, d = self.create2()
        a.pack_configure()
        b.pack_configure()
        c.pack_configure()
        self.assertEqual(pack.pack_slaves(), [a, b, c])
        b.pack_forget()
        self.assertEqual(pack.pack_slaves(), [a, c])
        b.pack_forget()
        self.assertEqual(pack.pack_slaves(), [a, c])
        d.pack_forget()

    def test_pack_info(self):
        pack, a, b, c, d = self.create2()
        with self.assertRaisesRegexp(TclError, 'window "%s" isn\'t packed' % a):
            a.pack_info()
        a.pack_configure()
        b.pack_configure(side='right', in_=a, anchor='s', expand=True, fill='x',
                         ipadx=5, padx=10, ipady=2, pady=(5, 15))
        info = a.pack_info()
        self.assertIsInstance(info, dict)
        self.assertEqual(info['anchor'], 'center')
        self.assertEqual(info['expand'], self._str(0))
        self.assertEqual(info['fill'], 'none')
        self.assertEqual(info['in'], pack)
        self.assertEqual(info['ipadx'], self._str(0))
        self.assertEqual(info['ipady'], self._str(0))
        self.assertEqual(info['padx'], self._str(0))
        self.assertEqual(info['pady'], self._str(0))
        self.assertEqual(info['side'], 'top')
        info = b.pack_info()
        self.assertIsInstance(info, dict)
        self.assertEqual(info['anchor'], 's')
        self.assertEqual(info['expand'], self._str(1))
        self.assertEqual(info['fill'], 'x')
        self.assertEqual(info['in'], a)
        self.assertEqual(info['ipadx'], self._str(5))
        self.assertEqual(info['ipady'], self._str(2))
        self.assertEqual(info['padx'], self._str(10))
        self.assertEqual(info['pady'], self._str((5, 15)))
        self.assertEqual(info['side'], 'right')

    def test_pack_propagate(self):
        pack, a, b, c, d = self.create2()
        pack.configure(width=300, height=200)
        a.pack_configure()
        pack.pack_propagate(False)
        self.root.update()
        self.assertEqual(pack.winfo_reqwidth(), 300)
        self.assertEqual(pack.winfo_reqheight(), 200)
        pack.pack_propagate(True)
        self.root.update()
        self.assertEqual(pack.winfo_reqwidth(), 20)
        self.assertEqual(pack.winfo_reqheight(), 40)

    def test_pack_slaves(self):
        pack, a, b, c, d = self.create2()
        self.assertEqual(pack.pack_slaves(), [])
        a.pack_configure()
        self.assertEqual(pack.pack_slaves(), [a])
        b.pack_configure()
        self.assertEqual(pack.pack_slaves(), [a, b])


class PlaceTest(AbstractWidgetTest, unittest.TestCase):

    test_keys = None

    def create2(self):
        t = tkinter.Toplevel(self.root, width=300, height=200, bd=0)
        t.wm_geometry('300x200+0+0')
        f = tkinter.Frame(t, width=154, height=84, bd=2, relief='raised')
        f.place_configure(x=48, y=38)
        f2 = tkinter.Frame(t, width=30, height=60, bd=2, relief='raised')
        self.root.update()
        return t, f, f2

    def test_place_configure_in(self):
        t, f, f2 = self.create2()
        self.assertEqual(f2.winfo_manager(), '')
        with self.assertRaisesRegexp(TclError, "can't place %s relative to "
                                     "itself" % re.escape(str(f2))):
            f2.place_configure(in_=f2)
        if tcl_version >= (8, 5):
            self.assertEqual(f2.winfo_manager(), '')
        with self.assertRaisesRegexp(TclError, 'bad window path name'):
            f2.place_configure(in_='spam')
        f2.place_configure(in_=f)
        self.assertEqual(f2.winfo_manager(), 'place')

    def test_place_configure_x(self):
        t, f, f2 = self.create2()
        f2.place_configure(in_=f)
        self.assertEqual(f2.place_info()['x'], '0')
        self.root.update()
        self.assertEqual(f2.winfo_x(), 50)
        f2.place_configure(x=100)
        self.assertEqual(f2.place_info()['x'], '100')
        self.root.update()
        self.assertEqual(f2.winfo_x(), 150)
        f2.place_configure(x=-10, relx=1)
        self.assertEqual(f2.place_info()['x'], '-10')
        self.root.update()
        self.assertEqual(f2.winfo_x(), 190)
        with self.assertRaisesRegexp(TclError, 'bad screen distance "spam"'):
            f2.place_configure(in_=f, x='spam')

    def test_place_configure_y(self):
        t, f, f2 = self.create2()
        f2.place_configure(in_=f)
        self.assertEqual(f2.place_info()['y'], '0')
        self.root.update()
        self.assertEqual(f2.winfo_y(), 40)
        f2.place_configure(y=50)
        self.assertEqual(f2.place_info()['y'], '50')
        self.root.update()
        self.assertEqual(f2.winfo_y(), 90)
        f2.place_configure(y=-10, rely=1)
        self.assertEqual(f2.place_info()['y'], '-10')
        self.root.update()
        self.assertEqual(f2.winfo_y(), 110)
        with self.assertRaisesRegexp(TclError, 'bad screen distance "spam"'):
            f2.place_configure(in_=f, y='spam')

    def test_place_configure_relx(self):
        t, f, f2 = self.create2()
        f2.place_configure(in_=f)
        self.assertEqual(f2.place_info()['relx'], '0')
        self.root.update()
        self.assertEqual(f2.winfo_x(), 50)
        f2.place_configure(relx=0.5)
        self.assertEqual(f2.place_info()['relx'], '0.5')
        self.root.update()
        self.assertEqual(f2.winfo_x(), 125)
        f2.place_configure(relx=1)
        self.assertEqual(f2.place_info()['relx'], '1')
        self.root.update()
        self.assertEqual(f2.winfo_x(), 200)
        with self.assertRaisesRegexp(TclError, 'expected floating-point number '
                                     'but got "spam"'):
            f2.place_configure(in_=f, relx='spam')

    def test_place_configure_rely(self):
        t, f, f2 = self.create2()
        f2.place_configure(in_=f)
        self.assertEqual(f2.place_info()['rely'], '0')
        self.root.update()
        self.assertEqual(f2.winfo_y(), 40)
        f2.place_configure(rely=0.5)
        self.assertEqual(f2.place_info()['rely'], '0.5')
        self.root.update()
        self.assertEqual(f2.winfo_y(), 80)
        f2.place_configure(rely=1)
        self.assertEqual(f2.place_info()['rely'], '1')
        self.root.update()
        self.assertEqual(f2.winfo_y(), 120)
        with self.assertRaisesRegexp(TclError, 'expected floating-point number '
                                     'but got "spam"'):
            f2.place_configure(in_=f, rely='spam')

    def test_place_configure_anchor(self):
        f = tkinter.Frame(self.root)
        with self.assertRaisesRegexp(TclError, 'bad anchor "j"'):
            f.place_configure(anchor='j')
        with self.assertRaisesRegexp(TclError, 'ambiguous anchor ""'):
            f.place_configure(anchor='')
        for value in 'n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw', 'center':
            f.place_configure(anchor=value)
            self.assertEqual(f.place_info()['anchor'], value)

    def test_place_configure_width(self):
        t, f, f2 = self.create2()
        f2.place_configure(in_=f, width=120)
        self.root.update()
        self.assertEqual(f2.winfo_width(), 120)
        f2.place_configure(width='')
        self.root.update()
        self.assertEqual(f2.winfo_width(), 30)
        with self.assertRaisesRegexp(TclError, 'bad screen distance "abcd"'):
            f2.place_configure(width='abcd')

    def test_place_configure_height(self):
        t, f, f2 = self.create2()
        f2.place_configure(in_=f, height=120)
        self.root.update()
        self.assertEqual(f2.winfo_height(), 120)
        f2.place_configure(height='')
        self.root.update()
        self.assertEqual(f2.winfo_height(), 60)
        with self.assertRaisesRegexp(TclError, 'bad screen distance "abcd"'):
            f2.place_configure(height='abcd')

    def test_place_configure_relwidth(self):
        t, f, f2 = self.create2()
        f2.place_configure(in_=f, relwidth=0.5)
        self.root.update()
        self.assertEqual(f2.winfo_width(), 75)
        f2.place_configure(relwidth='')
        self.root.update()
        self.assertEqual(f2.winfo_width(), 30)
        with self.assertRaisesRegexp(TclError, 'expected floating-point number '
                                     'but got "abcd"'):
            f2.place_configure(relwidth='abcd')

    def test_place_configure_relheight(self):
        t, f, f2 = self.create2()
        f2.place_configure(in_=f, relheight=0.5)
        self.root.update()
        self.assertEqual(f2.winfo_height(), 40)
        f2.place_configure(relheight='')
        self.root.update()
        self.assertEqual(f2.winfo_height(), 60)
        with self.assertRaisesRegexp(TclError, 'expected floating-point number '
                                     'but got "abcd"'):
            f2.place_configure(relheight='abcd')

    def test_place_configure_bordermode(self):
        f = tkinter.Frame(self.root)
        with self.assertRaisesRegexp(TclError, 'bad bordermode "j"'):
            f.place_configure(bordermode='j')
        with self.assertRaisesRegexp(TclError, 'ambiguous bordermode ""'):
            f.place_configure(bordermode='')
        for value in 'inside', 'outside', 'ignore':
            f.place_configure(bordermode=value)
            self.assertEqual(f.place_info()['bordermode'], value)

    def test_place_forget(self):
        foo = tkinter.Frame(self.root)
        foo.place_configure(width=50, height=50)
        self.root.update()
        foo.place_forget()
        self.root.update()
        self.assertFalse(foo.winfo_ismapped())
        with self.assertRaises(TypeError):
            foo.place_forget(0)

    def test_place_info(self):
        t, f, f2 = self.create2()
        f2.place_configure(in_=f, x=1, y=2, width=3, height=4,
                           relx=0.1, rely=0.2, relwidth=0.3, relheight=0.4,
                           anchor='se', bordermode='outside')
        info = f2.place_info()
        self.assertIsInstance(info, dict)
        self.assertEqual(info['x'], '1')
        self.assertEqual(info['y'], '2')
        self.assertEqual(info['width'], '3')
        self.assertEqual(info['height'], '4')
        self.assertEqual(info['relx'], '0.1')
        self.assertEqual(info['rely'], '0.2')
        self.assertEqual(info['relwidth'], '0.3')
        self.assertEqual(info['relheight'], '0.4')
        self.assertEqual(info['anchor'], 'se')
        self.assertEqual(info['bordermode'], 'outside')
        self.assertEqual(info['x'], '1')
        self.assertEqual(info['x'], '1')
        with self.assertRaises(TypeError):
            f2.place_info(0)

    def test_place_slaves(self):
        foo = tkinter.Frame(self.root)
        bar = tkinter.Frame(self.root)
        self.assertEqual(foo.place_slaves(), [])
        bar.place_configure(in_=foo)
        self.assertEqual(foo.place_slaves(), [bar])
        with self.assertRaises(TypeError):
            foo.place_slaves(0)


class GridTest(AbstractWidgetTest, unittest.TestCase):

    test_keys = None

    def tearDown(self):
        cols, rows = self.root.grid_size()
        for i in range(cols + 1):
            self.root.grid_columnconfigure(i, weight=0, minsize=0, pad=0, uniform='')
        for i in range(rows + 1):
            self.root.grid_rowconfigure(i, weight=0, minsize=0, pad=0, uniform='')
        self.root.grid_propagate(1)
        super(GridTest, self).tearDown()

    def test_grid_configure(self):
        b = tkinter.Button(self.root)
        self.assertEqual(b.grid_info(), {})
        b.grid_configure()
        self.assertEqual(b.grid_info()['in'], self.root)
        self.assertEqual(b.grid_info()['column'], self._str(0))
        self.assertEqual(b.grid_info()['row'], self._str(0))
        b.grid_configure({'column': 1}, row=2)
        self.assertEqual(b.grid_info()['column'], self._str(1))
        self.assertEqual(b.grid_info()['row'], self._str(2))

    def test_grid_configure_column(self):
        b = tkinter.Button(self.root)
        with self.assertRaisesRegexp(TclError, 'bad column value "-1": '
                                     'must be a non-negative integer'):
            b.grid_configure(column=-1)
        b.grid_configure(column=2)
        self.assertEqual(b.grid_info()['column'], self._str(2))

    def test_grid_configure_columnspan(self):
        b = tkinter.Button(self.root)
        with self.assertRaisesRegexp(TclError, 'bad columnspan value "0": '
                                     'must be a positive integer'):
            b.grid_configure(columnspan=0)
        b.grid_configure(columnspan=2)
        self.assertEqual(b.grid_info()['columnspan'], self._str(2))

    def test_grid_configure_in(self):
        f = tkinter.Frame(self.root)
        b = tkinter.Button(self.root)
        self.assertEqual(b.grid_info(), {})
        b.grid_configure()
        self.assertEqual(b.grid_info()['in'], self.root)
        b.grid_configure(in_=f)
        self.assertEqual(b.grid_info()['in'], f)
        b.grid_configure({'in': self.root})
        self.assertEqual(b.grid_info()['in'], self.root)

    def test_grid_configure_ipadx(self):
        b = tkinter.Button(self.root)
        with self.assertRaisesRegexp(TclError, 'bad ipadx value "-1": '
                                     'must be positive screen distance'):
            b.grid_configure(ipadx=-1)
        b.grid_configure(ipadx=1)
        self.assertEqual(b.grid_info()['ipadx'], self._str(1))
        b.grid_configure(ipadx='.5c')
        self.assertEqual(b.grid_info()['ipadx'],
                self._str(int_round(pixels_conv('.5c') * self.scaling)))

    def test_grid_configure_ipady(self):
        b = tkinter.Button(self.root)
        with self.assertRaisesRegexp(TclError, 'bad ipady value "-1": '
                                     'must be positive screen distance'):
            b.grid_configure(ipady=-1)
        b.grid_configure(ipady=1)
        self.assertEqual(b.grid_info()['ipady'], self._str(1))
        b.grid_configure(ipady='.5c')
        self.assertEqual(b.grid_info()['ipady'],
                self._str(int_round(pixels_conv('.5c') * self.scaling)))

    def test_grid_configure_padx(self):
        b = tkinter.Button(self.root)
        with self.assertRaisesRegexp(TclError, 'bad pad value "-1": '
                                     'must be positive screen distance'):
            b.grid_configure(padx=-1)
        b.grid_configure(padx=1)
        self.assertEqual(b.grid_info()['padx'], self._str(1))
        b.grid_configure(padx=(10, 5))
        self.assertEqual(b.grid_info()['padx'], self._str((10, 5)))
        b.grid_configure(padx='.5c')
        self.assertEqual(b.grid_info()['padx'],
                self._str(int_round(pixels_conv('.5c') * self.scaling)))

    def test_grid_configure_pady(self):
        b = tkinter.Button(self.root)
        with self.assertRaisesRegexp(TclError, 'bad pad value "-1": '
                                     'must be positive screen distance'):
            b.grid_configure(pady=-1)
        b.grid_configure(pady=1)
        self.assertEqual(b.grid_info()['pady'], self._str(1))
        b.grid_configure(pady=(10, 5))
        self.assertEqual(b.grid_info()['pady'], self._str((10, 5)))
        b.grid_configure(pady='.5c')
        self.assertEqual(b.grid_info()['pady'],
                self._str(int_round(pixels_conv('.5c') * self.scaling)))

    def test_grid_configure_row(self):
        b = tkinter.Button(self.root)
        with self.assertRaisesRegexp(TclError, 'bad (row|grid) value "-1": '
                                     'must be a non-negative integer'):
            b.grid_configure(row=-1)
        b.grid_configure(row=2)
        self.assertEqual(b.grid_info()['row'], self._str(2))

    def test_grid_configure_rownspan(self):
        b = tkinter.Button(self.root)
        with self.assertRaisesRegexp(TclError, 'bad rowspan value "0": '
                                     'must be a positive integer'):
            b.grid_configure(rowspan=0)
        b.grid_configure(rowspan=2)
        self.assertEqual(b.grid_info()['rowspan'], self._str(2))

    def test_grid_configure_sticky(self):
        f = tkinter.Frame(self.root, bg='red')
        with self.assertRaisesRegexp(TclError, 'bad stickyness value "glue"'):
            f.grid_configure(sticky='glue')
        f.grid_configure(sticky='ne')
        self.assertEqual(f.grid_info()['sticky'], 'ne')
        f.grid_configure(sticky='n,s,e,w')
        self.assertEqual(f.grid_info()['sticky'], 'nesw')

    def test_grid_columnconfigure(self):
        with self.assertRaises(TypeError):
            self.root.grid_columnconfigure()
        self.assertEqual(self.root.grid_columnconfigure(0),
                         {'minsize': 0, 'pad': 0, 'uniform': None, 'weight': 0})
        with self.assertRaisesRegexp(TclError, 'bad option "-foo"'):
            self.root.grid_columnconfigure(0, 'foo')
        self.root.grid_columnconfigure((0, 3), weight=2)
        with self.assertRaisesRegexp(TclError,
                                     'must specify a single element on retrieval'):
            self.root.grid_columnconfigure((0, 3))
        b = tkinter.Button(self.root)
        b.grid_configure(column=0, row=0)
        if tcl_version >= (8, 5):
            self.root.grid_columnconfigure('all', weight=3)
            with self.assertRaisesRegexp(TclError, 'expected integer but got "all"'):
                self.root.grid_columnconfigure('all')
            self.assertEqual(self.root.grid_columnconfigure(0, 'weight'), 3)
        self.assertEqual(self.root.grid_columnconfigure(3, 'weight'), 2)
        self.assertEqual(self.root.grid_columnconfigure(265, 'weight'), 0)
        if tcl_version >= (8, 5):
            self.root.grid_columnconfigure(b, weight=4)
            self.assertEqual(self.root.grid_columnconfigure(0, 'weight'), 4)

    def test_grid_columnconfigure_minsize(self):
        with self.assertRaisesRegexp(TclError, 'bad screen distance "foo"'):
            self.root.grid_columnconfigure(0, minsize='foo')
        self.root.grid_columnconfigure(0, minsize=10)
        self.assertEqual(self.root.grid_columnconfigure(0, 'minsize'), 10)
        self.assertEqual(self.root.grid_columnconfigure(0)['minsize'], 10)

    def test_grid_columnconfigure_weight(self):
        with self.assertRaisesRegexp(TclError, 'expected integer but got "bad"'):
            self.root.grid_columnconfigure(0, weight='bad')
        with self.assertRaisesRegexp(TclError, 'invalid arg "-weight": '
                                     'should be non-negative'):
            self.root.grid_columnconfigure(0, weight=-3)
        self.root.grid_columnconfigure(0, weight=3)
        self.assertEqual(self.root.grid_columnconfigure(0, 'weight'), 3)
        self.assertEqual(self.root.grid_columnconfigure(0)['weight'], 3)

    def test_grid_columnconfigure_pad(self):
        with self.assertRaisesRegexp(TclError, 'bad screen distance "foo"'):
            self.root.grid_columnconfigure(0, pad='foo')
        with self.assertRaisesRegexp(TclError, 'invalid arg "-pad": '
                                     'should be non-negative'):
            self.root.grid_columnconfigure(0, pad=-3)
        self.root.grid_columnconfigure(0, pad=3)
        self.assertEqual(self.root.grid_columnconfigure(0, 'pad'), 3)
        self.assertEqual(self.root.grid_columnconfigure(0)['pad'], 3)

    def test_grid_columnconfigure_uniform(self):
        self.root.grid_columnconfigure(0, uniform='foo')
        self.assertEqual(self.root.grid_columnconfigure(0, 'uniform'), 'foo')
        self.assertEqual(self.root.grid_columnconfigure(0)['uniform'], 'foo')

    def test_grid_rowconfigure(self):
        with self.assertRaises(TypeError):
            self.root.grid_rowconfigure()
        self.assertEqual(self.root.grid_rowconfigure(0),
                         {'minsize': 0, 'pad': 0, 'uniform': None, 'weight': 0})
        with self.assertRaisesRegexp(TclError, 'bad option "-foo"'):
            self.root.grid_rowconfigure(0, 'foo')
        self.root.grid_rowconfigure((0, 3), weight=2)
        with self.assertRaisesRegexp(TclError,
                                     'must specify a single element on retrieval'):
            self.root.grid_rowconfigure((0, 3))
        b = tkinter.Button(self.root)
        b.grid_configure(column=0, row=0)
        if tcl_version >= (8, 5):
            self.root.grid_rowconfigure('all', weight=3)
            with self.assertRaisesRegexp(TclError, 'expected integer but got "all"'):
                self.root.grid_rowconfigure('all')
            self.assertEqual(self.root.grid_rowconfigure(0, 'weight'), 3)
        self.assertEqual(self.root.grid_rowconfigure(3, 'weight'), 2)
        self.assertEqual(self.root.grid_rowconfigure(265, 'weight'), 0)
        if tcl_version >= (8, 5):
            self.root.grid_rowconfigure(b, weight=4)
            self.assertEqual(self.root.grid_rowconfigure(0, 'weight'), 4)

    def test_grid_rowconfigure_minsize(self):
        with self.assertRaisesRegexp(TclError, 'bad screen distance "foo"'):
            self.root.grid_rowconfigure(0, minsize='foo')
        self.root.grid_rowconfigure(0, minsize=10)
        self.assertEqual(self.root.grid_rowconfigure(0, 'minsize'), 10)
        self.assertEqual(self.root.grid_rowconfigure(0)['minsize'], 10)

    def test_grid_rowconfigure_weight(self):
        with self.assertRaisesRegexp(TclError, 'expected integer but got "bad"'):
            self.root.grid_rowconfigure(0, weight='bad')
        with self.assertRaisesRegexp(TclError, 'invalid arg "-weight": '
                                     'should be non-negative'):
            self.root.grid_rowconfigure(0, weight=-3)
        self.root.grid_rowconfigure(0, weight=3)
        self.assertEqual(self.root.grid_rowconfigure(0, 'weight'), 3)
        self.assertEqual(self.root.grid_rowconfigure(0)['weight'], 3)

    def test_grid_rowconfigure_pad(self):
        with self.assertRaisesRegexp(TclError, 'bad screen distance "foo"'):
            self.root.grid_rowconfigure(0, pad='foo')
        with self.assertRaisesRegexp(TclError, 'invalid arg "-pad": '
                                     'should be non-negative'):
            self.root.grid_rowconfigure(0, pad=-3)
        self.root.grid_rowconfigure(0, pad=3)
        self.assertEqual(self.root.grid_rowconfigure(0, 'pad'), 3)
        self.assertEqual(self.root.grid_rowconfigure(0)['pad'], 3)

    def test_grid_rowconfigure_uniform(self):
        self.root.grid_rowconfigure(0, uniform='foo')
        self.assertEqual(self.root.grid_rowconfigure(0, 'uniform'), 'foo')
        self.assertEqual(self.root.grid_rowconfigure(0)['uniform'], 'foo')

    def test_grid_forget(self):
        b = tkinter.Button(self.root)
        c = tkinter.Button(self.root)
        b.grid_configure(row=2, column=2, rowspan=2, columnspan=2,
                         padx=3, pady=4, sticky='ns')
        self.assertEqual(self.root.grid_slaves(), [b])
        b.grid_forget()
        c.grid_forget()
        self.assertEqual(self.root.grid_slaves(), [])
        self.assertEqual(b.grid_info(), {})
        b.grid_configure(row=0, column=0)
        info = b.grid_info()
        self.assertEqual(info['row'], self._str(0))
        self.assertEqual(info['column'], self._str(0))
        self.assertEqual(info['rowspan'], self._str(1))
        self.assertEqual(info['columnspan'], self._str(1))
        self.assertEqual(info['padx'], self._str(0))
        self.assertEqual(info['pady'], self._str(0))
        self.assertEqual(info['sticky'], '')

    def test_grid_remove(self):
        b = tkinter.Button(self.root)
        c = tkinter.Button(self.root)
        b.grid_configure(row=2, column=2, rowspan=2, columnspan=2,
                         padx=3, pady=4, sticky='ns')
        self.assertEqual(self.root.grid_slaves(), [b])
        b.grid_remove()
        c.grid_remove()
        self.assertEqual(self.root.grid_slaves(), [])
        self.assertEqual(b.grid_info(), {})
        b.grid_configure(row=0, column=0)
        info = b.grid_info()
        self.assertEqual(info['row'], self._str(0))
        self.assertEqual(info['column'], self._str(0))
        self.assertEqual(info['rowspan'], self._str(2))
        self.assertEqual(info['columnspan'], self._str(2))
        self.assertEqual(info['padx'], self._str(3))
        self.assertEqual(info['pady'], self._str(4))
        self.assertEqual(info['sticky'], 'ns')

    def test_grid_info(self):
        b = tkinter.Button(self.root)
        self.assertEqual(b.grid_info(), {})
        b.grid_configure(row=2, column=2, rowspan=2, columnspan=2,
                         padx=3, pady=4, sticky='ns')
        info = b.grid_info()
        self.assertIsInstance(info, dict)
        self.assertEqual(info['in'], self.root)
        self.assertEqual(info['row'], self._str(2))
        self.assertEqual(info['column'], self._str(2))
        self.assertEqual(info['rowspan'], self._str(2))
        self.assertEqual(info['columnspan'], self._str(2))
        self.assertEqual(info['padx'], self._str(3))
        self.assertEqual(info['pady'], self._str(4))
        self.assertEqual(info['sticky'], 'ns')

    def test_grid_bbox(self):
        self.assertEqual(self.root.grid_bbox(), (0, 0, 0, 0))
        self.assertEqual(self.root.grid_bbox(0, 0), (0, 0, 0, 0))
        self.assertEqual(self.root.grid_bbox(0, 0, 1, 1), (0, 0, 0, 0))
        with self.assertRaisesRegexp(TclError, 'expected integer but got "x"'):
            self.root.grid_bbox('x', 0)
        with self.assertRaisesRegexp(TclError, 'expected integer but got "x"'):
            self.root.grid_bbox(0, 'x')
        with self.assertRaisesRegexp(TclError, 'expected integer but got "x"'):
            self.root.grid_bbox(0, 0, 'x', 0)
        with self.assertRaisesRegexp(TclError, 'expected integer but got "x"'):
            self.root.grid_bbox(0, 0, 0, 'x')
        with self.assertRaises(TypeError):
            self.root.grid_bbox(0, 0, 0, 0, 0)
        t = self.root
        # de-maximize
        t.wm_geometry('1x1+0+0')
        t.wm_geometry('')
        f1 = tkinter.Frame(t, width=75, height=75, bg='red')
        f2 = tkinter.Frame(t, width=90, height=90, bg='blue')
        f1.grid_configure(row=0, column=0)
        f2.grid_configure(row=1, column=1)
        self.root.update()
        self.assertEqual(t.grid_bbox(), (0, 0, 165, 165))
        self.assertEqual(t.grid_bbox(0, 0), (0, 0, 75, 75))
        self.assertEqual(t.grid_bbox(0, 0, 1, 1), (0, 0, 165, 165))
        self.assertEqual(t.grid_bbox(1, 1), (75, 75, 90, 90))
        self.assertEqual(t.grid_bbox(10, 10, 0, 0), (0, 0, 165, 165))
        self.assertEqual(t.grid_bbox(-2, -2, -1, -1), (0, 0, 0, 0))
        self.assertEqual(t.grid_bbox(10, 10, 12, 12), (165, 165, 0, 0))

    def test_grid_location(self):
        with self.assertRaises(TypeError):
            self.root.grid_location()
        with self.assertRaises(TypeError):
            self.root.grid_location(0)
        with self.assertRaises(TypeError):
            self.root.grid_location(0, 0, 0)
        with self.assertRaisesRegexp(TclError, 'bad screen distance "x"'):
            self.root.grid_location('x', 'y')
        with self.assertRaisesRegexp(TclError, 'bad screen distance "y"'):
            self.root.grid_location('1c', 'y')
        t = self.root
        # de-maximize
        t.wm_geometry('1x1+0+0')
        t.wm_geometry('')
        f = tkinter.Frame(t, width=200, height=100,
                          highlightthickness=0, bg='red')
        self.assertEqual(f.grid_location(10, 10), (-1, -1))
        f.grid_configure()
        self.root.update()
        self.assertEqual(t.grid_location(-10, -10), (-1, -1))
        self.assertEqual(t.grid_location(-10, 0), (-1, 0))
        self.assertEqual(t.grid_location(-1, 0), (-1, 0))
        self.assertEqual(t.grid_location(0, -10), (0, -1))
        self.assertEqual(t.grid_location(0, -1), (0, -1))
        self.assertEqual(t.grid_location(0, 0), (0, 0))
        self.assertEqual(t.grid_location(200, 0), (0, 0))
        self.assertEqual(t.grid_location(201, 0), (1, 0))
        self.assertEqual(t.grid_location(0, 100), (0, 0))
        self.assertEqual(t.grid_location(0, 101), (0, 1))
        self.assertEqual(t.grid_location(201, 101), (1, 1))

    def test_grid_propagate(self):
        self.assertEqual(self.root.grid_propagate(), True)
        with self.assertRaises(TypeError):
            self.root.grid_propagate(False, False)
        self.root.grid_propagate(False)
        self.assertFalse(self.root.grid_propagate())
        f = tkinter.Frame(self.root, width=100, height=100, bg='red')
        f.grid_configure(row=0, column=0)
        self.root.update()
        self.assertEqual(f.winfo_width(), 100)
        self.assertEqual(f.winfo_height(), 100)
        f.grid_propagate(False)
        g = tkinter.Frame(self.root, width=75, height=85, bg='green')
        g.grid_configure(in_=f, row=0, column=0)
        self.root.update()
        self.assertEqual(f.winfo_width(), 100)
        self.assertEqual(f.winfo_height(), 100)
        f.grid_propagate(True)
        self.root.update()
        self.assertEqual(f.winfo_width(), 75)
        self.assertEqual(f.winfo_height(), 85)

    def test_grid_size(self):
        with self.assertRaises(TypeError):
            self.root.grid_size(0)
        self.assertEqual(self.root.grid_size(), (0, 0))
        f = tkinter.Scale(self.root)
        f.grid_configure(row=0, column=0)
        self.assertEqual(self.root.grid_size(), (1, 1))
        f.grid_configure(row=4, column=5)
        self.assertEqual(self.root.grid_size(), (6, 5))

    def test_grid_slaves(self):
        self.assertEqual(self.root.grid_slaves(), [])
        a = tkinter.Label(self.root)
        a.grid_configure(row=0, column=1)
        b = tkinter.Label(self.root)
        b.grid_configure(row=1, column=0)
        c = tkinter.Label(self.root)
        c.grid_configure(row=1, column=1)
        d = tkinter.Label(self.root)
        d.grid_configure(row=1, column=1)
        self.assertEqual(self.root.grid_slaves(), [d, c, b, a])
        self.assertEqual(self.root.grid_slaves(row=0), [a])
        self.assertEqual(self.root.grid_slaves(row=1), [d, c, b])
        self.assertEqual(self.root.grid_slaves(column=0), [b])
        self.assertEqual(self.root.grid_slaves(column=1), [d, c, a])
        self.assertEqual(self.root.grid_slaves(row=1, column=1), [d, c])


tests_gui = (
    PackTest, PlaceTest, GridTest,
)

if __name__ == '__main__':
    run_unittest(*tests_gui)
test_tkinter/test_loadtk.pyo000064400000003314150351526610012336 0ustar00�
zfc@s�ddlZddlZddlZddlmZddlmZmZejd�dej	fd��YZ
e
fZedkr�ej
e�ndS(i����N(ttest_support(tTcltTclErrortguit
TkLoadTestcBs5eZejdejkd�d��Zd�ZRS(tDISPLAYsNo $DISPLAY set.cCsJt�}|jt|j�|j�|jd|j��|j�dS(Ns1x1+0+0(RtassertRaisesRtwinfo_geometrytloadtktassertEqualtdestroy(tselfttcl((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_loadtk.pyt
testLoadTks
	
cCs�d}tjjd�rdStj��t}dtjkri|d=tjd�j	�j
�}|ridSnt�}|jt
|j�|jt
|j�WdQXdS(NtwintdarwintcygwinRs
echo $DISPLAY(RRR(tNonetsystplatformt
startswithRtEnvironmentVarGuardtostenvirontpopentreadtstripRRRRR(Rtold_displaytenvtdisplayR((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_loadtk.pyttestLoadTkFailures	(t__name__t
__module__tunittesttskipIfRRR
R(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_loadtk.pyR	s$t__main__(RRR!ttestRtTkinterRRtrequirestTestCaseRt	tests_guiRtrun_unittest(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_loadtk.pyt<module>s
!	test_tkinter/test_loadtk.py000064400000002662150351526610012164 0ustar00import os
import sys
import unittest
from test import test_support
from Tkinter import Tcl, TclError

test_support.requires('gui')

class TkLoadTest(unittest.TestCase):

    @unittest.skipIf('DISPLAY' not in os.environ, 'No $DISPLAY set.')
    def testLoadTk(self):
        tcl = Tcl()
        self.assertRaises(TclError,tcl.winfo_geometry)
        tcl.loadtk()
        self.assertEqual('1x1+0+0', tcl.winfo_geometry())
        tcl.destroy()

    def testLoadTkFailure(self):
        old_display = None
        if sys.platform.startswith(('win', 'darwin', 'cygwin')):
            # no failure possible on windows?

            # XXX Maybe on tk older than 8.4.13 it would be possible,
            # see tkinter.h.
            return
        with test_support.EnvironmentVarGuard() as env:
            if 'DISPLAY' in os.environ:
                del env['DISPLAY']
                # on some platforms, deleting environment variables
                # doesn't actually carry through to the process level
                # because they don't support unsetenv
                # If that's the case, abort.
                display = os.popen('echo $DISPLAY').read().strip()
                if display:
                    return

            tcl = Tcl()
            self.assertRaises(TclError, tcl.winfo_geometry)
            self.assertRaises(TclError, tcl.loadtk)

tests_gui = (TkLoadTest, )

if __name__ == "__main__":
    test_support.run_unittest(*tests_gui)
test_tkinter/test_geometry_managers.pyc000064400000120324150351526610014555 0ustar00�
zfc@sddlZddlZddlZddlmZddlmZmZddlm	Z	m
Z
mZddlm
Z
mZed�de
ejfd��YZd	e
ejfd
��YZde
ejfd��YZeeefZed
kree�ndS(i����N(tTclError(trequirestrun_unittest(tpixels_convttcl_versiontrequires_tcl(tAbstractWidgetTestt	int_roundtguitPackTestcBs�eZd
Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�ZRS(c
Cs�tj|jdd�}|jd�|jdd�tj|dddddd	d
d�}tj|dddd
ddd
d�}tj|ddddddd
d�}tj|dddd	ddd
d�}|||||fS(Ntnametpacks300x200+0+0itatwidthitheighti(tbgtredtbi2itbluetciPtgreentdtyellow(ttkintertTopleveltroottwm_geometryt
wm_minsizetFrame(tselfRRRRR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pytcreate2s
''''cCs;|j�\}}}}}|jtd|��|jd|�WdQX|jtd��|jdd�WdQX|jdd�|jdd�|jdd�|jdd�|j|j�||||g�|jd|�|j|j�||||g�|jd|�|j|j�||||g�dS(Nswindow "%s" isn't packedtaftersbad window path name ".foo"s.footsidettop(RtassertRaisesRegexpRtpack_configuretassertEqualtpack_slaves(RRRRRR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_pack_configure_afters""cs��j�\}�}}}��fd�}|dd�|dd�|dd�|dd	�|d
d�|dd
�|dd�|dd�|dd�dS(Ncs[�jddddddddd	d
dtd|��jj��j�j�|�dS(
NR R!tipadxitpadxi
tipadyitpadyitexpandtanchor(R#tTrueRtupdateR$twinfo_geometry(R,tgeom(RR(sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pytcheck-s'

tns30x70+135+20tnes30x70+260+20tes30x70+260+65tses
30x70+260+110tss
30x70+135+110tsws30x70+10+110tws30x70+10+65tnws30x70+10+20tcenters30x70+135+65(R(RRRRRR1((RRsG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_pack_configure_anchor+s







cCs;|j�\}}}}}|jtd|��|jd|�WdQX|jtd��|jdd�WdQX|jdd�|jdd�|jdd�|jdd�|j|j�||||g�|jd|�|j|j�||||g�|jd|�|j|j�||||g�dS(Nswindow "%s" isn't packedtbeforesbad window path name ".foo"s.fooR R!(RR"RR#R$R%(RRRRRR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_pack_configure_before<s""cs{�j�\}���������fd�}�jdd��jdd��jdd��jdd�|ddd	d
��jdddd��jdddd
��jdddt��jdddd�|dddd��jdddddd��jdddd
dd��jdddtdd��jdddddd�|dddd�dS(Ncsy�jj��j�j�|d��j�j�|d��j�j�|d��j�j�|d�dS(Niiii(RR.R$R/(tgeoms(RRRRR(sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyR1Ns

R tleftR!trighttbottoms
20x40+0+80s50x30+135+0s80x80+220+75s
40x30+100+170R+tyestonis20x40+40+80s50x30+175+35s
80x80+180+110s
40x30+100+135tfilltboths100x200+0+0s
200x100+100+0s160x100+140+100s40x100+100+100(RR#R-(RRR1((RRRRRsG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_pack_configure_expandLs"cCs2|j�\}}}}}|jdd�|jdd�|jdd�|jdd�|jd|�|j|j�||||g�|jd|�|j|j�|||g�|j|j�|g�|jtd|f��|jd|�WdQX|jtd��|jdd�WdQXdS(NR R!tin_scan't pack %s inside itselfsbad window path name ".foo"s.foo(RR#R$R%R"R(RRRRRR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_pack_configure_inds"	cs��j�\}��}}���fd�}|dddddd�|dddddd'�|dddddd�|d
ddddddd	�|dddddddd�|dddddd(dd�|dddddddd�|d
ddddddd	dd�|dddddddd)dd�|dddddd�|dddddd*�|dddddd�|dddddddd	�|dddddddd+�|d ddddddd�|d!ddddd,dd�|d#ddddddd�|d$ddddddd	dd�|d%ddddddd-dd��jdd&��j�j�d�j|jd&����jdd&��j�j�d�j|jd&���dS(.Ncst�j��j��j|��jdtdd��jj��j�j�|��j�j�|�dS(NR+RDRE(tpack_forgetR#R-RR.R$R/(tgeom1tgeom2tkwargs(RRR(sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyR1ws



s20x40+260+80s240x200+0+0R R@R(is20x40+250+80i
is60x40+240+80R's30x40+260+80s250x200+0+0iRDtxs20x40+249+80i	is30x40+255+80is20x40+140+0s300x160+0+40R!s20x40+120+0ii(s60x40+120+0s30x40+135+0s30x40+130+0s260x40+20+0s260x40+25+0is
300x40+0+0s280x40+10+0s
280x40+5+0t1c(i
i(i	i(ii(ii((ii(ii(ii(RR#R$t	pack_infot_strtwinfo_pixels(RRRRR1((RRRsG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyt#test_pack_configure_padx_ipadx_fillusBcs��j�\}��}}���fd�}|dddddd�|dddddd'�|dddddd�|d
ddddddd	�|dddddddd�|dddddd(dd�|dddddddd�|d
ddddddd	dd�|dddddddd)dd�|dddddd�|dddddd*�|dddddd�|dddddddd	�|dddddddd+�|d ddddddd�|d!ddddd,dd�|d#ddddddd�|d$ddddddd	dd�|d%ddddddd-dd��jdd&��j�j�d�j|jd&����jdd&��j�j�d�j|jd&���dS(.Ncst�j��j��j|��jdtdd��jj��j�j�|��j�j�|�dS(NR+RDRE(RIR#R-RR.R$R/(RJRKRL(RRR(sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyR1�s



s20x40+280+80s280x200+0+0R R@R*is20x40+280+70i
is20x80+280+60R)s20x50+280+75iRDRMs20x40+280+69i	is20x50+280+70is20x40+140+20s300x120+0+80R!s20x40+140+0ii(s20x80+140+0s20x50+140+10s300x130+0+70s20x50+140+5s300x40+0+20s300x40+0+25is
300x80+0+0s300x50+0+10s
300x50+0+5RN(i
i(i	i(ii(ii((ii(ii(ii(RR#R$RORPRQ(RRRRR1((RRRsG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyt#test_pack_configure_pady_ipady_fill�sBcst�j�\}��}}���fd�}|ddd�|ddd�|dd	d
�|ddd
�dS(Ncs}�jd|��j�j�d|��jdtdd��jj��j�j�|��j�j�|�dS(NR R+RDRE(R#R$ROR-RR.R/(R RJRK(RRR(sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyR1�s
R!s20x40+140+0s300x160+0+40RAs
20x40+140+160s300x160+0+0R?s
20x40+0+80s280x200+20+0R@s20x40+280+80s280x200+0+0(R(RRRRR1((RRRsG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_pack_configure_side�scCs�|j�\}}}}}|j�|j�|j�|j|j�|||g�|j�|j|j�||g�|j�|j|j�||g�|j�dS(N(RR#R$R%RI(RRRRRR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_pack_forget�s




cCs�|j�\}}}}}|jtd|��|j�WdQX|j�|jddd|dddtdd	d
ddd
dddd�	|j�}|j|t�|j|dd�|j|d|j	d��|j|dd�|j|d|�|j|d
|j	d��|j|d|j	d��|j|d|j	d��|j|d|j	d��|j|dd�|j�}|j|t�|j|dd�|j|d|j	d��|j|dd	�|j|d|�|j|d
|j	d��|j|d|j	d��|j|d|j	d
��|j|d|j	d��|j|dd�dS(Nswindow "%s" isn't packedR R@RGR,R6R+RDRMR'iR(i
R)iR*iR:itnonetinR!i(ii(ii(
RR"RROR#R-tassertIsInstancetdictR$RP(RRRRRRtinfo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_pack_info�s8
'cCs�|j�\}}}}}|jdddd�|j�|jt�|jj�|j|j�d�|j|j	�d�|jt
�|jj�|j|j�d�|j|j	�d�dS(NR
i,Ri�ii((Rt	configureR#tpack_propagatetFalseRR.R$twinfo_reqwidthtwinfo_reqheightR-(RRRRRR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_pack_propagates




cCs~|j�\}}}}}|j|j�g�|j�|j|j�|g�|j�|j|j�||g�dS(N(RR$R%R#(RRRRRR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_pack_slavess

N(t__name__t
__module__tNonet	test_keysRR&R;R=RFRHRRRSRTRUR[RaRb(((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyR	
s	
						*	*				
t	PlaceTestcBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�ZRS(c
Cs�tj|jdddddd�}|jd�tj|dddd	dd
dd�}|jd
ddd�tj|dddddd
dd�}|jj�|||fS(NR
i,Ri�tbdis300x200+0+0i�iTitrelieftraisedRMi0tyi&ii<(RRRRRtplace_configureR.(Rtttftf2((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyRs$
''
cCs�|j�\}}}|j|j�d�|jtdtjt|����|jd|�WdQXt	d	kr�|j|j�d�n|jtd��|jdd�WdQX|jd|�|j|j�d�dS(
Nts!can't place %s relative to itselfRGiisbad window path nametspamtplace(ii(
RR$t
winfo_managerR"RtretescapetstrRlR(RRmRnRo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_in$sc	Cs5|j�\}}}|jd|�|j|j�dd�|jj�|j|j�d�|jdd�|j|j�dd�|jj�|j|j�d�|jddd	d
�|j|j�dd�|jj�|j|j�d�|jtd
��|jd|dd�WdQXdS(NRGRMt0i2idt100i�i����trelxis-10i�sbad screen distance "spam"Rq(	RRlR$t
place_infoRR.twinfo_xR"R(RRmRnRo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_x1s


c	Cs5|j�\}}}|jd|�|j|j�dd�|jj�|j|j�d�|jdd�|j|j�dd�|jj�|j|j�d�|jddd	d
�|j|j�dd�|jj�|j|j�d�|jtd
��|jd|dd�WdQXdS(NRGRkRxi(i2t50iZi����trelyis-10insbad screen distance "spam"Rq(	RRlR$R{RR.twinfo_yR"R(RRmRnRo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_yBs


c	Cs/|j�\}}}|jd|�|j|j�dd�|jj�|j|j�d�|jdd�|j|j�dd�|jj�|j|j�d�|jdd�|j|j�dd	�|jj�|j|j�d
�|jtd��|jd|dd�WdQXdS(
NRGRzRxi2g�?s0.5i}it1i�s-expected floating-point number but got "spam"Rq(	RRlR$R{RR.R|R"R(RRmRnRo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_relxSs


c	Cs/|j�\}}}|jd|�|j|j�dd�|jj�|j|j�d�|jdd�|j|j�dd�|jj�|j|j�d�|jdd�|j|j�dd	�|jj�|j|j�d
�|jtd��|jd|dd�WdQXdS(
NRGRRxi(g�?s0.5iPiR�ixs-expected floating-point number but got "spam"Rq(	RRlR$R{RR.R�R"R(RRmRnRo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_relyes


cCs�tj|j�}|jtd��|jdd�WdQX|jtd��|jdd�WdQXx8dD]0}|jd|�|j|j�d|�qkWdS(Nsbad anchor "j"R,tjsambiguous anchor ""RpR2R3R4R5R6R7R8R9R:(	R2R3R4R5R6R7R8R9R:(RRRR"RRlR$R{(RRntvalue((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_anchorws
cCs�|j�\}}}|jd|dd�|jj�|j|j�d�|jdd�|jj�|j|j�d�|jtd��|jdd�WdQXdS(NRGR
ixRpisbad screen distance "abcd"tabcd(RRlRR.R$twinfo_widthR"R(RRmRnRo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_width�s

cCs�|j�\}}}|jd|dd�|jj�|j|j�d�|jdd�|jj�|j|j�d�|jtd��|jdd�WdQXdS(NRGRixRpi<sbad screen distance "abcd"R�(RRlRR.R$twinfo_heightR"R(RRmRnRo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_height�s

cCs�|j�\}}}|jd|dd�|jj�|j|j�d�|jdd�|jj�|j|j�d�|jtd��|jdd�WdQXdS(	NRGtrelwidthg�?iKRpis-expected floating-point number but got "abcd"R�(RRlRR.R$R�R"R(RRmRnRo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_relwidth�s

cCs�|j�\}}}|jd|dd�|jj�|j|j�d�|jdd�|jj�|j|j�d�|jtd��|jdd�WdQXdS(	NRGt	relheightg�?i(Rpi<s-expected floating-point number but got "abcd"R�(RRlRR.R$R�R"R(RRmRnRo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_relheight�s

cCs�tj|j�}|jtd��|jdd�WdQX|jtd��|jdd�WdQXx8d	D]0}|jd|�|j|j�d|�qkWdS(
Nsbad bordermode "j"t
bordermodeR�sambiguous bordermode ""Rptinsidetoutsidetignore(R�R�R�(RRRR"RRlR$R{(RRnR�((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_bordermode�s
cCs�tj|j�}|jdddd�|jj�|j�|jj�|j|j��|jt	��|jd�WdQXdS(NR
i2Ri(
RRRRlR.tplace_forgettassertFalsetwinfo_ismappedtassertRaisest	TypeError(Rtfoo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_forget�s


cCs�|j�\}}}|jd|dddddddd	d
ddd
dddddddd�|j�}|j|t�|j|dd�|j|dd�|j|dd�|j|dd�|j|d
d�|j|dd�|j|dd�|j|dd�|j|dd�|j|dd�|j|dd�|j|dd�|jt��|jd�WdQXdS(NRGRMiRkiR
iRiRzg�������?Rg�������?R�g333333�?R�g�������?R,R5R�R�R�t2t3t4s0.1s0.2s0.3s0.4i(RRlR{RXRYR$R�R�(RRmRnRoRZ((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_info�s('
cCs�tj|j�}tj|j�}|j|j�g�|jd|�|j|j�|g�|jt��|jd�WdQXdS(NRGi(RRRR$tplace_slavesRlR�R�(RR�tbar((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_slaves�sN(RcRdReRfRRwR}R�R�R�R�R�R�R�R�R�R�R�R�(((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyRgs 			
					
					
	
	tGridTestcBseZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!RS(cCs�|jj�\}}x@t|d�D].}|jj|dddddddd�q&Wx@t|d�D].}|jj|dddddddd�qiW|jjd�tt|�j�dS(NitweightitminsizetpadtuniformRp(	Rt	grid_sizetrangetgrid_columnconfiguretgrid_rowconfiguretgrid_propagatetsuperR�ttearDown(Rtcolstrowsti((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyR��s,,cCs�tj|j�}|j|j�i�|j�|j|j�d|j�|j|j�d|jd��|j|j�d|jd��|jidd6dd�|j|j�d|jd��|j|j�d|jd��dS(NRWtcolumnitrowii(RtButtonRR$t	grid_infotgrid_configureRP(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure�s
###cCsrtj|j�}|jtd��|jdd�WdQX|jdd�|j|j�d|jd��dS(Ns5bad column value "-1": must be a non-negative integerR�i����i(	RR�RR"RR�R$R�RP(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure_column�s
cCsrtj|j�}|jtd��|jdd�WdQX|jdd�|j|j�d|jd��dS(Ns4bad columnspan value "0": must be a positive integert
columnspanii(	RR�RR"RR�R$R�RP(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure_columnspans
cCs�tj|j�}tj|j�}|j|j�i�|j�|j|j�d|j�|jd|�|j|j�d|�|ji|jd6�|j|j�d|j�dS(NRWRG(RRRR�R$R�R�(RRnR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure_ins
cCs�tj|j�}|jtd��|jdd�WdQX|jdd�|j|j�d|jd��|jdd�|j|j�d|jt	t
d�|j���dS(Ns6bad ipadx value "-1": must be positive screen distanceR'i����is.5c(RR�RR"RR�R$R�RPRRtscaling(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure_ipadxs#cCs�tj|j�}|jtd��|jdd�WdQX|jdd�|j|j�d|jd��|jdd�|j|j�d|jt	t
d�|j���dS(Ns6bad ipady value "-1": must be positive screen distanceR)i����is.5c(RR�RR"RR�R$R�RPRRR�(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure_ipady!s#cCs�tj|j�}|jtd��|jdd�WdQX|jdd�|j|j�d|jd��|jdd�|j|j�d|jd	��|jdd�|j|j�d|jt	t
d�|j���dS(
Ns4bad pad value "-1": must be positive screen distanceR(i����ii
is.5c(i
i(i
i(RR�RR"RR�R$R�RPRRR�(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure_padx,s##cCs�tj|j�}|jtd��|jdd�WdQX|jdd�|j|j�d|jd��|jdd�|j|j�d|jd	��|jdd�|j|j�d|jt	t
d�|j���dS(
Ns4bad pad value "-1": must be positive screen distanceR*i����ii
is.5c(i
i(i
i(RR�RR"RR�R$R�RPRRR�(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure_pady9s##cCsrtj|j�}|jtd��|jdd�WdQX|jdd�|j|j�d|jd��dS(Ns9bad (row|grid) value "-1": must be a non-negative integerR�i����i(	RR�RR"RR�R$R�RP(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure_rowFs
cCsrtj|j�}|jtd��|jdd�WdQX|jdd�|j|j�d|jd��dS(Ns1bad rowspan value "0": must be a positive integertrowspanii(	RR�RR"RR�R$R�RP(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure_rownspanNs
cCs�tj|jdd�}|jtd��|jdd�WdQX|jdd�|j|j�dd�|jdd�|j|j�dd�dS(	NRRsbad stickyness value "glue"tstickytglueR3sn,s,e,wtnesw(RRRR"RR�R$R�(RRn((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure_stickyVsc	Cs�|jt��|jj�WdQX|j|jjd�idd6dd6dd6dd6�|jtd��|jjdd�WdQX|jjddd	�|jtd
��|jjd�WdQXtj	|j�}|j
dddd�tdkr[|jjddd�|jtd��|jjd�WdQX|j|jjdd�d�n|j|jjdd�d	�|j|jjdd�d�tdkr�|jj|dd�|j|jjdd�d�ndS(NiR�R�R�R�sbad option "-foo"R�iis*must specify a single element on retrievalR�R�iitallsexpected integer but got "all"i	i(ii(ii(ii(ii(R�R�RR�R$ReR"RRR�R�R(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_columnconfigure_s,#	
"cCs�|jtd��|jjddd�WdQX|jjddd�|j|jjdd�d�|j|jjd�dd�dS(Nsbad screen distance "foo"iR�R�i
(R"RRR�R$(R((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyt!test_grid_columnconfigure_minsizews
c	Cs�|jtd��|jjddd�WdQX|jtd��|jjddd�WdQX|jjddd�|j|jjdd�d�|j|jjd�dd�dS(Nsexpected integer but got "bad"iR�tbads-invalid arg "-weight": should be non-negativei����i(R"RRR�R$(R((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyt test_grid_columnconfigure_weight~sc	Cs�|jtd��|jjddd�WdQX|jtd��|jjddd�WdQX|jjddd�|j|jjdd�d�|j|jjd�dd�dS(Nsbad screen distance "foo"iR�R�s*invalid arg "-pad": should be non-negativei����i(R"RRR�R$(R((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_columnconfigure_pad�scCsY|jjddd�|j|jjdd�d�|j|jjd�dd�dS(NiR�R�(RR�R$(R((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyt!test_grid_columnconfigure_uniform�sc	Cs�|jt��|jj�WdQX|j|jjd�idd6dd6dd6dd6�|jtd��|jjdd�WdQX|jjddd	�|jtd
��|jjd�WdQXtj	|j�}|j
dddd�tdkr[|jjddd�|jtd��|jjd�WdQX|j|jjdd�d�n|j|jjdd�d	�|j|jjdd�d�tdkr�|jj|dd�|j|jjdd�d�ndS(NiR�R�R�R�sbad option "-foo"R�iis*must specify a single element on retrievalR�R�iiR�sexpected integer but got "all"i	i(ii(ii(ii(ii(R�R�RR�R$ReR"RRR�R�R(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_rowconfigure�s,#	
"cCs�|jtd��|jjddd�WdQX|jjddd�|j|jjdd�d�|j|jjd�dd�dS(Nsbad screen distance "foo"iR�R�i
(R"RRR�R$(R((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_rowconfigure_minsize�s
c	Cs�|jtd��|jjddd�WdQX|jtd��|jjddd�WdQX|jjddd�|j|jjdd�d�|j|jjd�dd�dS(Nsexpected integer but got "bad"iR�R�s-invalid arg "-weight": should be non-negativei����i(R"RRR�R$(R((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_rowconfigure_weight�sc	Cs�|jtd��|jjddd�WdQX|jtd��|jjddd�WdQX|jjddd�|j|jjdd�d�|j|jjd�dd�dS(Nsbad screen distance "foo"iR�R�s*invalid arg "-pad": should be non-negativei����i(R"RRR�R$(R((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_rowconfigure_pad�scCsY|jjddd�|j|jjdd�d�|j|jjd�dd�dS(NiR�R�(RR�R$(R((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_rowconfigure_uniform�scCs�tj|j�}tj|j�}|jdddddddddddd	d
d�|j|jj�|g�|j�|j�|j|jj�g�|j|j�i�|jdddd�|j�}|j|d|jd��|j|d|jd��|j|d|jd
��|j|d|jd
��|j|d|jd��|j|d|jd��|j|d
d�dS(NR�iR�R�R�R(iR*iR�tnsiiRp(	RR�RR�R$tgrid_slavestgrid_forgetR�RP(RRRRZ((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_forget�s$!

cCs�tj|j�}tj|j�}|jdddddddddddd	d
d�|j|jj�|g�|j�|j�|j|jj�g�|j|j�i�|jdddd�|j�}|j|d|jd��|j|d|jd��|j|d|jd��|j|d|jd��|j|d|jd��|j|d|jd	��|j|d
d�dS(
NR�iR�R�R�R(iR*iR�R�i(	RR�RR�R$R�tgrid_removeR�RP(RRRRZ((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_remove�s$!

cCsUtj|j�}|j|j�i�|jdddddddddddd	d
d�|j�}|j|t�|j|d|j�|j|d|jd��|j|d|jd��|j|d|jd��|j|d|jd��|j|d|jd��|j|d|jd	��|j|d
d�dS(
NR�iR�R�R�R(iR*iR�R�RW(	RR�RR$R�R�RXRYRP(RRRZ((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_info�s!cCs�|j|jj�d�|j|jjdd�d�|j|jjdddd�d�|jtd��|jjdd�WdQX|jtd��|jjdd�WdQX|jtd��|jjdddd�WdQX|jtd��|jjdddd�WdQX|jt��!|jjddddd�WdQX|j}|jd�|jd�tj	|ddd	dd
d�}tj	|ddd	dd
d
�}|j
dddd�|j
dddd�|jj�|j|j�d�|j|jdd�d�|j|jdddd�d�|j|jdd�d�|j|jdddd�d�|j|jdddd�d�|j|jdddd�d�dS(Niisexpected integer but got "x"RMs1x1+0+0RpR
iKRRRiZRR�R�i�i
i����i����i(iiii(iiii(iiii(iii�i�(iiiKiK(iii�i�(iKiKiZiZ(iii�i�(iiii(i�i�ii(R$Rt	grid_bboxR"RR�R�RRRR�R.(RRmtf1Ro((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_bboxs8%"	

!!
"""cCs�|jt��|jj�WdQX|jt��|jjd�WdQX|jt��|jjddd�WdQX|jtd��|jjdd�WdQX|jtd��|jjdd�WdQX|j}|jd�|jd�tj|d	d
ddd
ddd�}|j	|jdd�d�|j
�|jj�|j	|jdd�d�|j	|jdd�d�|j	|jdd�d�|j	|jdd�d�|j	|jdd�d�|j	|jdd�d�|j	|jd
d�d�|j	|jdd�d�|j	|jdd�d�|j	|jdd�d �|j	|jdd�d!�dS("Nisbad screen distance "x"RMRksbad screen distance "y"RNs1x1+0+0RpR
i�RidthighlightthicknessRRi
i����i����i�iie(i����i����(i����i����(i����i(i����i(ii����(ii����(ii(ii(ii(ii(ii(ii(R�R�Rt
grid_locationR"RRRRR$R�R.(RRmRn((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_location&s:	



c	Cs�|j|jj�t�|jt��|jjtt�WdQX|jjt�|j|jj��tj	|jdddddd�}|j
dddd�|jj�|j|j�d�|j|j
�d�|jt�tj	|jdd	dd
dd�}|j
d|dddd�|jj�|j|j�d�|j|j
�d�|jt�|jj�|j|j�d	�|j|j
�d
�dS(
NR
idRRRR�iR�iKiURRG(R$RR�R-R�R�R^R�RRR�R.R�R�(RRntg((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_propagateFs($

$


cCs�|jt��|jjd�WdQX|j|jj�d�tj|j�}|jdddd�|j|jj�d	�|jdddd�|j|jj�d
�dS(NiR�R�iiii(ii(ii(ii(R�R�RR�R$RtScaleR�(RRn((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_size\scCs�|j|jj�g�tj|j�}|jdddd�tj|j�}|jdddd�tj|j�}|jdddd�tj|j�}|jdddd�|j|jj�||||g�|j|jjdd�|g�|j|jjdd�|||g�|j|jjdd�|g�|j|jjdd�|||g�|j|jjdddd�||g�dS(NR�iR�i(R$RR�RtLabelR�(RRRRR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_slavesfs%"("(N("RcRdReRfR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�(((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyR��s>									
	
							
	
				
	
						 		
t__main__(tunittestRttTkinterRRttest.test_supportRRttest_ttk.supportRRRtwidget_testsRRtTestCaseR	RgR�t	tests_guiRc(((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyt<module>s
����test_tkinter/test_font.py000064400000007746150351526620011665 0ustar00import unittest
import Tkinter as tkinter
import tkFont as font
from test.test_support import requires, run_unittest, gc_collect
from test_ttk.support import AbstractTkTest

requires('gui')

fontname = "TkDefaultFont"

class FontTest(AbstractTkTest, unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        AbstractTkTest.setUpClass.__func__(cls)
        try:
            cls.font = font.Font(root=cls.root, name=fontname, exists=True)
        except tkinter.TclError:
            cls.font = font.Font(root=cls.root, name=fontname, exists=False)

    def test_configure(self):
        options = self.font.configure()
        self.assertGreaterEqual(set(options),
            {'family', 'size', 'weight', 'slant', 'underline', 'overstrike'})
        for key in options:
            self.assertEqual(self.font.cget(key), options[key])
            self.assertEqual(self.font[key], options[key])
        for key in 'family', 'weight', 'slant':
            self.assertIsInstance(options[key], str)
            self.assertIsInstance(self.font.cget(key), str)
            self.assertIsInstance(self.font[key], str)
        sizetype = int if self.wantobjects else str
        for key in 'size', 'underline', 'overstrike':
            self.assertIsInstance(options[key], sizetype)
            self.assertIsInstance(self.font.cget(key), sizetype)
            self.assertIsInstance(self.font[key], sizetype)

    def test_unicode_family(self):
        family = u'MS \u30b4\u30b7\u30c3\u30af'
        try:
            f = font.Font(root=self.root, family=family, exists=True)
        except tkinter.TclError:
            f = font.Font(root=self.root, family=family, exists=False)
        self.assertEqual(f.cget('family'), family)
        del f
        gc_collect()

    def test_actual(self):
        options = self.font.actual()
        self.assertGreaterEqual(set(options),
            {'family', 'size', 'weight', 'slant', 'underline', 'overstrike'})
        for key in options:
            self.assertEqual(self.font.actual(key), options[key])
        for key in 'family', 'weight', 'slant':
            self.assertIsInstance(options[key], str)
            self.assertIsInstance(self.font.actual(key), str)
        sizetype = int if self.wantobjects else str
        for key in 'size', 'underline', 'overstrike':
            self.assertIsInstance(options[key], sizetype)
            self.assertIsInstance(self.font.actual(key), sizetype)

    def test_name(self):
        self.assertEqual(self.font.name, fontname)
        self.assertEqual(str(self.font), fontname)

    def test_eq(self):
        font1 = font.Font(root=self.root, name=fontname, exists=True)
        font2 = font.Font(root=self.root, name=fontname, exists=True)
        self.assertIsNot(font1, font2)
        self.assertEqual(font1, font2)
        self.assertNotEqual(font1, font1.copy())
        self.assertNotEqual(font1, 0)
        self.assertNotIn(font1, [0])

    def test_measure(self):
        self.assertIsInstance(self.font.measure('abc'), int)

    def test_metrics(self):
        metrics = self.font.metrics()
        self.assertGreaterEqual(set(metrics),
            {'ascent', 'descent', 'linespace', 'fixed'})
        for key in metrics:
            self.assertEqual(self.font.metrics(key), metrics[key])
            self.assertIsInstance(metrics[key], int)
            self.assertIsInstance(self.font.metrics(key), int)

    def test_families(self):
        families = font.families(self.root)
        self.assertIsInstance(families, tuple)
        self.assertTrue(families)
        for family in families:
            self.assertIsInstance(family, (str, unicode))
            self.assertTrue(family)

    def test_names(self):
        names = font.names(self.root)
        self.assertIsInstance(names, tuple)
        self.assertTrue(names)
        for name in names:
            self.assertIsInstance(name, (str, unicode))
            self.assertTrue(name)
        self.assertIn(fontname, names)

tests_gui = (FontTest, )

if __name__ == "__main__":
    run_unittest(*tests_gui)
test_tkinter/test_images.pyo000064400000037047150351526620012340 0ustar00�
zfc@s�ddlZddlZddlZddljZddlmZm	Z	ej
d�deejfd��YZdeejfd��YZ
deejfd	��YZee
efZed
kr�eje�ndS(i����N(tAbstractTkTesttrequires_tcltguitMiscTestcBseZd�Zd�ZRS(cCsC|jj�}|j|t�|jd|�|jd|�dS(Ntphototbitmap(troottimage_typestassertIsInstancettupletassertIn(tselfR((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_image_typesscCs#|jj�}|j|t�dS(N(Rtimage_namesRR	(RR
((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_image_namess(t__name__t
__module__RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyR
s	tBitmapImageTestcBsVeZed��Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(cCs,tjj|�tjddd�|_dS(Ns
python.xbmtsubdirt
imghdrdata(Rt
setUpClasst__func__tsupporttfindfilettestfile(tcls((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyRsc
Cs�tjdd|jddddd|j�}|jt|�d�|j|j�d�|j|j�d	�|j|j�d	�|j	d|jj
��~|jd|jj
��dS(
Ns::img::testtmastert
foregroundtyellowt
backgroundtbluetfileRi(ttkintertBitmapImageRRtassertEqualtstrttypetwidththeightR
R
tassertNotIn(Rtimage((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_create_from_filescCs�t|jd��}|j�}WdQXtjdd|jddddd|�}|jt|�d�|j|j�d	�|j|j	�d
�|j|j
�d
�|jd|jj��~|j
d|jj��dS(Ntrbs::img::testRRRRRtdataRi(topenRtreadR R!RR"R#R$R%R&R
R
R'(RtfR+R(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_create_from_data*s	cCs0|j|t�|j|jj|�|�dS(N(RR#R"Rt	splitlist(Rtactualtexpected((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pytassertEqualStrList8scCs�tjdd|j�}|j|dd�t|jd��}|j�}WdQX|jd|�|j|ddddd|f�|j|j	�d�|j|j
�d�|j|d	d
�|jd	|�|j|d	dddd|f�dS(Ns::img::testRR+s-data {} {} {} {}R*s-datatitmaskdatas-maskdata {} {} {} {}s	-maskdata(R R!RR"R,RR-t	configureR3R%R&(RR(R.R+((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_configure_data<s

cCs�tjdd|j�}|j|dd�|jd|j�|j|ddddd|jf�|j|j�d�|j|j�d�|j|dd	�|jd|j�|j|dd
ddd|jf�dS(Ns::img::testRRs-file {} {} {} {}s-fileR4itmaskfiles-maskfile {} {} {} {}s	-maskfile(	R R!RR"R6RR3R%R&(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_configure_fileLs

cCsTtjdd|j�}|j|dd�|jdd�|j|dd�dS(Ns::img::testRRs-background {} {} {} {}Rs-background {} {} {} blue(R R!RR"R6(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_configure_backgroundZscCsTtjdd|j�}|j|dd�|jdd�|j|dd�dS(Ns::img::testRRs!-foreground {} {} #000000 #000000Rs -foreground {} {} #000000 yellow(R R!RR"R6(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_configure_foreground`s

(RRtclassmethodRR)R/R3R7R9R:R;(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyRs						tPhotoImageTestcBseZed��Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
edd�d
��Zedd�d��Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs,tjj|�tjddd�|_dS(Ns
python.gifRR(RRRRRR(R((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyRkscCstjdd|jd|j�S(Ns::img::testRR(R t
PhotoImageRR(R((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pytcreatepscGs-tjdkr|jr|Stj|�SdS(Ng333333!@(R t	TkVersiontwantobjectst_join(Rtargs((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyt	colorlisttscCs�tjd|dd�}tjdd|jd|�}|jt|�d�|j|j�d�|j|j�d�|j|j	�d�|j|d	d
�|j|d|�|j
d|jj��~|jd|jj��dS(Nspython.RRs::img::testRRRiR+R4(
RRR R>RR"R#R$R%R&R
R
R'(RtextRR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pytcheck_create_from_filezs	cCs,tjd|dd�}t|d��}|j�}WdQXtjdd|jd|�}|jt|�d�|j|j	�d�|j|j
�d	�|j|j�d	�|j|d|jr�|n|j
d
��|j|dd�|jd|jj��~|jd|jj��dS(
Nspython.RRR*s::img::testRR+Ritlatin1RR4(RRR,R-R R>RR"R#R$R%R&RAtdecodeR
R
R'(RRERR.R+R(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pytcheck_create_from_data�s	cCs|jd�dS(Ntppm(RF(R((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_create_from_ppm_file�scCs|jd�dS(NRJ(RI(R((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_create_from_ppm_data�scCs|jd�dS(Ntpgm(RF(R((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_create_from_pgm_file�scCs|jd�dS(NRM(RI(R((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_create_from_pgm_data�scCs|jd�dS(Ntgif(RF(R((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_create_from_gif_file�scCs|jd�dS(NRP(RI(R((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_create_from_gif_data�siicCs|jd�dS(Ntpng(RF(R((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_create_from_png_file�scCs|jd�dS(NRS(RI(R((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_create_from_png_data�scCs�tjdd|j�}|j|dd�t|jd��}|j�}WdQX|jd|�|j|d|jr|n|j	d��|j|j
�d�|j|j�d�dS(Ns::img::testRR+R4R*RGi(R R>RR"R,RR-R6RARHR%R&(RR(R.R+((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyR7�scCs�tjdd|j�}|j|dd�|jd|jdd�|j|d|jradnd�|j|j�d�|j|j�d�dS(	Ns::img::testRtformatR4RRPi(RP(	R R>RR"R6RRAR%R&(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_configure_format�scCs�tjdd|j�}|j|dd�|jd|j�|j|d|j�|j|j�d�|j|j�d�dS(Ns::img::testRRR4i(R R>RR"R6RR%R&(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyR9�scCsTtjdd|j�}|j|dd�|jdd�|j|dd�dS(Ns::img::testRtgammas1.0g@s2.0(R R>RR"R6(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_configure_gamma�scCs�tjdd|j�}|j|dd�|j|dd�|jdd�|jdd�|j|dd�|j|dd	�|j|j�d�|j|j�d�dS(
Ns::img::testRR%t0R&ii
t20t10(R R>RR"R6R%R&(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_configure_width_height�scCsxtjdd|j�}|j|dd�|jdd�|j|dd�|jdd�|j|dd�dS(Ns::img::testRtpaletteR4it256s3/4/2(R R>RR"R6(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_configure_palette�scCsq|j�}|j�|j|j�d�|j|j�d�|j|jdd�|jddd��dS(Niiii(R?tblankR"R%R&tgetRD(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyt
test_blank�s

cCsp|j�}|j�}|j|j�d�|j|j�d�|j|jdd�|jdd��dS(Niii(R?tcopyR"R%R&Rb(RR(timage2((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyt	test_copy�s
cCs�|j�}|jdd�}|j|j�d�|j|j�d�|j|jdd�|jdd��|jd�}|j|j�d�|j|j�d�|j|jdd�|jdd��dS(Niiiii(R?t	subsampleR"R%R&Rb(RR(Re((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_subsample�s(cCs)|j�}|jdd�}|j|j�d�|j|j�d�|j|jdd�|jdd��|j|jd	d
�|jdd��|jd�}|j|j�d�|j|j�d�|j|jdd�|jdd��|j|jd	d�|jdd��dS(
Niii i0iiiii	iii
(R?tzoomR"R%R&Rb(RR(Re((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyt	test_zooms(((cCs�|j�}|jddd�|j|jdd�|jddd��|j|jdd�|jdtjdkr}d	ndd��|j|jdd
�|jddd��|j|jdd
�|jddd��|jddf�|j|jdd�|jddd��|j|jdd�|jddd��|j|jdd�|jddd��|j|jdd�|jddd��dS(Ns{red green} {blue yellow}ttoiii�iig333333!@i�is#f00s#00ff00s
#000000fffs
#ffffffff0000i(ii(s#f00s#00ff00(s
#000000fffs
#ffffffff0000(R?tputR"RbRDR R@(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_puts+
+++++cCs|j�}|j|jdd�|jddd��|j|jdd�|jddd��|j|jdd�|jddd��|jtj|jdd�|jtj|jdd�|jtj|jd	d�|jtj|jdd	�dS(
Niii>iti�iii����i(R?R"RbRDtassertRaisesR tTclError(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_get s+++c	Cs�|j�}|jtjtj�|jtj�tjdd|jdddtj�}|j	t
|�d�|j	|j�d�|j	|j�d�|j	|j
�d�|j	|jdd�|jdd��|j	|jd	d
�|jd	d
��|jtjdddd�tjdd|jdddtj�}|j	t
|�d�|j	|j�d�|j	|j�d�|j	|j
�d�|j	|jdd�|jd
d��|j	|jdd�|jdd
��dS(Ns::img::test2RRVRJRRiiiiRPtfrom_coordsiii	s::img::test3iiii(iiii	(R?t
addCleanupRtunlinktTESTFNtwriteR R>RR"R#R$R%R&Rb(RR(Retimage3((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyt
test_write*s,((((RRR<RR?RDRFRIRKRLRNRORQRRRRTRUR7RWR9RYR]R`RcRfRhRjRmRpRw(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyR=is4																							
t__main__(tunittesttTkinterR tttkttest.test_supportttest_supportRttest_ttk.supportRRtrequirestTestCaseRRR=t	tests_guiRtrun_unittest(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyt<module>s

R�test_tkinter/test_widgets.pyo000064400000172022150351526620012532 0ustar00�
zfc@sTddlZddlZddlmZddlZddlZddlmZmZddl	m
Z
mZmZm
Z
ddlmZmZmZmZmZmZmZmZmZmZed�deefd��YZee�d	eejfd
��Y�Zee�deejfd��Y�Zee�d
eejfd��Y�Zdeefd��YZee�deejfd��Y�Zee�deejfd��Y�Z ee�deejfd��Y�Z!ee�deejfd��Y�Z"ee�deejfd��Y�Z#de#ejfd��YZ$eee�deejfd��Y�Z%ee�de%ejfd ��Y�Z&ee�d!eejfd"��Y�Z'eee�d#eejfd$��Y�Z(eee�d%eejfd&��Y�Z)eee�d'eejfd(��Y�Z*eee�d)eejfd*��Y�Z+ee�d+eejfd,��Y�Z,ee�d-eejfd.��Y�Z-eee�d/eejfd0��Y�Z.e e(e!e%eeee)e#e-e.e$e,e"e*e+e&e'egZ/e0d1krPee/�ndS(2i����N(tTclError(trequirestrun_unittest(ttcl_versiontrequires_tcltget_tk_patchlevelt	widget_eq(
tadd_standard_optionstnoconvtnoconv_metht	int_roundtpixels_roundtAbstractWidgetTesttStandardOptionsTeststIntegerSizeTeststPixelSizeTeststsetUpModuletguitAbstractToplevelTestcBs2eZeZd�Zd�Zd�Zd�ZRS(cCso|j�}|j|d|jjj��|j|dddd�|jdd�}|j|dd�dS(NtclasstFooterrmsgs2can't modify -class option after widget is createdtclass_(tcreatetassertEqualt	__class__t__name__ttitletcheckInvalidParam(tselftwidgettwidget2((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_classs
cCsc|j�}|j|dd�|j|dddd�|jdd�}|j|dd�dS(NtcolormapttnewRs5can't modify -colormap option after widget is created(RRR(RRR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_colormapscCs�|j�}|j|d|jr(dnd�|j|dddd�|jdt�}|j|d|jrvdnd�dS(Nt	containerit0iRs6can't modify -container option after widget is createdt1(RRtwantobjectsRtTrue(RRR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_container's#cCsc|j�}|j|dd�|j|dddd�|jdd�}|j|dd�dS(NtvisualR"tdefaultRs3can't modify -visual option after widget is created(RRR(RRR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_visual/s(Rt
__module__R	t_conv_pad_pixelsR R$R*R-(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRs
				tToplevelTestcBs2eZdZd�Zd�Zd�Zd�ZRS(t
backgroundtborderwidthRR!R%tcursortheightthighlightbackgroundthighlightcolorthighlightthicknesstmenutpadxtpadytrelieftscreent	takefocustuseR+twidthcKstj|j|�S(N(ttkintertTopleveltroot(Rtkwargs((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRBscCsN|j�}tj|j�}|j|d|dt�|j|dd�dS(NR8teqR"(RR@tMenuRBt
checkParamR(RRR8((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt	test_menuEscCs�|j�}|j|dd�ytjd}Wntk
rQ|jd�nX|j|d|dd�|jd|�}|j|d|�dS(NR<R"tDISPLAYsNo $DISPLAY set.Rs3can't modify -screen option after widget is created(RRtostenvirontKeyErrortskipTestR(RRtdisplayR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_screenKs
cCsl|j�}|j|dd�|jdt�}d|j�}|jd|�}|j|d|�dS(NR>R"R%s%#x(RRR)twinfo_id(RRtparenttwidR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_useWs(R1R2RR!R%R3R4R5R6R7R8R9R:R;R<R=R>R+R?(RR.tOPTIONSRRGRNRR(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR08s			t	FrameTestcBseZdZd�ZRS(R1R2RR!R%R3R4R5R6R7R9R:R;R=R+R?cKstj|j|�S(N(R@tFrameRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRjs(R1R2RR!R%R3R4R5R6R7R9R:R;R=R+R?(RR.RSR(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRTas
tLabelFrameTestcBs)eZdZd�Zd�Zd�ZRS(R1R2RR!R%R3tfontt
foregroundR4R5R6R7tlabelanchortlabelwidgetR9R:R;R=ttextR+R?cKstj|j|�S(N(R@t
LabelFrameRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRyscCsW|j�}|j|ddddddddd	d
ddd
�|j|dd�dS(NRYtetentestntnetnwtstsetswtwtwntwstcenter(RtcheckEnumParamR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_labelanchor|s
cCsQ|j�}tj|jdddd�}|j|d|dd�|j�dS(NR[tMupptnametfooRZtexpecteds.foo(RR@tLabelRBRFtdestroy(RRtlabel((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_labelwidget�s(R1R2RR!R%R3RWRXR4R5R6R7RYRZR9R:R;R=R[R+R?(RR.RSRRkRs(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRVns		tAbstractLabelTestcBseZeZd�ZRS(c	Cs2|j�}|j|ddddddd�dS(NR7ig�������?g������@ii����t10p(RtcheckPixelsParam(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_highlightthickness�s(RR.R	t_conv_pixelsRw(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRt�st	LabelTestcBseZdZd�ZRS(tactivebackgroundtactiveforegroundtanchorR1tbitmapR2tcompoundR3tdisabledforegroundRWRXR4R5R6R7timagetjustifyR9R:R;tstateR=R[ttextvariablet	underlineR?t
wraplengthcKstj|j|�S(N(R@RpRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�s(RzR{R|R1R}R2R~R3RRWRXR4R5R6R7R�R�R9R:R;R�R=R[R�R�R?R�(RR.RSR(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRy�st
ButtonTestc Bs eZd"Zd �Zd!�ZRS(#RzR{R|R1R}R2tcommandR~R3R,RRWRXR4R5R6R7R�R�t
overreliefR9R:R;trepeatdelaytrepeatintervalR�R=R[R�R�R?R�cKstj|j|�S(N(R@tButtonRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs)|j�}|j|dddd�dS(NR,tactivetdisabledtnormal(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_default�s( RzR{R|R1R}R2R�R~R3R,RRWRXR4R5R6R7R�R�R�R9R:R;R�R�R�R=R[R�R�R?R�(RR.RSRR�(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR��s	tCheckbuttonTestc&Bs)eZd)Zd&�Zd'�Zd(�ZRS(*RzR{R|R1R}R2R�R~R3RRWRXR4R5R6R7R�tindicatoronR�t	offrelieftoffvaluetonvalueR�R9R:R;tselectcolortselectimageR�R=R[R�t
tristateimaget
tristatevalueR�tvariableR?R�cKstj|j|�S(N(R@tCheckbuttonRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs,|j�}|j|ddddd�dS(NR�igffffff@R"s
any string(RtcheckParams(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_offvalue�scCs,|j�}|j|ddddd�dS(NR�igffffff@R"s
any string(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_onvalue�s(&RzR{R|R1R}R2R�R~R3RRWRXR4R5R6R7R�R�R�R�R�R�R�R9R:R;R�R�R�R=R[R�R�R�R�R�R?R�(RR.RSRR�R�(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR��s		tRadiobuttonTestc%Bs eZd'Zd%�Zd&�ZRS((RzR{R|R1R}R2R�R~R3RRWRXR4R5R6R7R�R�R�R�R�R9R:R;R�R�R�R=R[R�R�R�R�tvalueR�R?R�cKstj|j|�S(N(R@tRadiobuttonRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs,|j�}|j|ddddd�dS(NR�igffffff@R"s
any string(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_value�s(%RzR{R|R1R}R2R�R~R3RRWRXR4R5R6R7R�R�R�R�R�R9R:R;R�R�R�R=R[R�R�R�R�R�R�R?R�(RR.RSRR�(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR��s	tMenubuttonTestcBs�eZd(Zee�Zd�Zd�Zd �Ze	j
jZ
ej
ejd!kd"�d#��Zd$�Zd%�Zd&�Zd'�ZRS()RzR{R|R1R}R2R~R3t	directionRRWRXR4R5R6R7R�R�R�R8R9R:R;R�R=R[R�R�R?R�cKstj|j|�S(N(R@t
MenubuttonRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs/|j�}|j|dddddd�dS(NR�tabovetbelowtflushtlefttright(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_direction�scCs/|j�}|j|dddddt�dS(NR4idi����itconv(RtcheckIntegerParamtstr(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_heightstdarwins"crashes with Cocoa Tk (issue19733)c	Cs�|j�}tjd|jdd�}|j|d|dt�d}|jtj��}d|d<WdQX|dk	r�|j	t|j
�|�n|jtj��}|jidd6�WdQX|dk	r�|j	t|j
�|�ndS(NtmasterRmtimage1R�R�simage "spam" doesn't existtspam(RR@t
PhotoImageRBRFR�tassertRaisesRtNoneRt	exceptiont	configure(RRR�Rtcm((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_image	scCsH|j�}tj|dd�}|j|d|dt�|j�dS(NRmR8RD(RR@RERFRRq(RRR8((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRGscCsE|j�}|j|ddddd�|j|dddd�dS(	NR9ig������@gffffff@t12mi����Roi(RRvRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt	test_padxscCsE|j�}|j|ddddd�|j|dddd�dS(	NR:ig������@gffffff@R�i����Roi(RRvRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt	test_pady$scCs/|j�}|j|dddddt�dS(NR?i�in���iR�(RR�R�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_width)s(RzR{R|R1R}R2R~R3R�RRWRXR4R5R6R7R�R�R�R8R9R:R;R�R=R[R�R�R?R�(RR.RStstaticmethodRRxRR�R�R
Rwtim_functunittesttskipIftsystplatformR�RGR�R�R�(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR��s(						tOptionMenuTestcBseZddd�ZRS(tbtatccKstj|jd|||�S(N(R@t
OptionMenuRBR�(RR,tvaluesRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR0s(R�R�R�(RR.R(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�.st	EntryTestcBsheZd)Zd�Zd �Zd!�Zd"�Zd#�Zd$�Zd%�Z	d&�Z
d'�Zd(�ZRS(*R1R2R3tdisabledbackgroundRtexportselectionRWRXR5R6R7tinsertbackgroundtinsertborderwidtht
insertofftimetinsertontimetinsertwidthtinvalidcommandR�treadonlybackgroundR;tselectbackgroundtselectborderwidthtselectforegroundtshowR�R=R�tvalidatetvalidatecommandR?txscrollcommandcKstj|j|�S(N(R@tEntryRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRCscCs |j�}|j|d�dS(NR�(RtcheckColorParam(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_disabledbackgroundFsc	CsQ|jdd�}|j|ddddddd	�|j|dd
dd
�dS(NR�idR�ig�������?g������@ii����Rui<Roii2(RRvRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_insertborderwidthJscCs�|j�}|j|dddd�|j|dddd�|j|dddd�td	�d
kr�|j|dd	dd�n|j|dd	dd�dS(NR�g�������?g������@Rug�������?Roii����g�������?ii(RRvRFR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_insertwidthQscCs0|j�}|j|d�|j|d�dS(NR�tinvcmd(RtcheckCommandParam(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_invalidcommand[scCs |j�}|j|d�dS(NR�(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_readonlybackground`scCsI|j�}|j|dd�|j|dd�|j|dd�dS(NR�t*R"t (RRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt	test_showdscCs)|j�}|j|dddd�dS(NR�R�R�treadonly(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_statejsc	Cs2|j�}|j|ddddddd�dS(NR�talltkeytfocustfocusintfocusouttnone(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_validateoscCs0|j�}|j|d�|j|d�dS(NR�tvcmd(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_validatecommandts(R1R2R3R�RR�RWRXR5R6R7R�R�R�R�R�R�R�R�R;R�R�R�R�R�R=R�R�R�R?R�(
RR.RSRR�R�R�R�R�R�R�R�R�(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�4s(				
					tSpinboxTestc,Bs�eZd9Zd,�Zd:Zd-�Zd.�Zd/�Zd0�Z	d1�Z
d2�Zd3�Zd4�Z
d5�Zd6�Zd7�Zd8�ZRS(;RzR1R2tbuttonbackgroundtbuttoncursortbuttondownrelieftbuttonupreliefR�R3R�RR�RWRXtformattfromR5R6R7t	incrementR�R�R�R�R�R�R�R;R�R�R�R�R�R�R�R=R�ttoR�R�R�R?twrapR�cKstj|j|�S(N(R@tSpinboxRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs |j�}|j|d�dS(NR�(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_buttonbackground�scCs |j�}|j|d�dS(NR�(RtcheckCursorParam(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_buttoncursor�scCs |j�}|j|d�dS(NR�(RtcheckReliefParam(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_buttondownrelief�scCs |j�}|j|d�dS(NR�(RR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_buttonuprelief�scCs�|j�}|j|dd�|j|dd�|j|dd�|j|dd�|j|dd�|j|dd�|j|dd�|j|dd	�|j|dd
�|j|dd�|j|dd�|j|dd
�dS(NR�s%2fs%2.2fs%.2fs%2.fs%2e-1fs2.2s%2.-2fs%-2.02fs% 2.02fs	% -2.200fs%09.200fs%d(RRFR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_format�scCsU|j�}|j|dd�|j|dddd�|j|dddd	�dS(
NR�gY@R�i����gffffff$@gffffff'@i�Rs*-to value must be greater than -from value(RRFtcheckFloatParamR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt	test_from�s
cCs/|j�}|j|dddddd�dS(NR�i����igffffff$@g������)@i(RR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_increment�scCsU|j�}|j|dd�|j|dddd�|j|dddd	�dS(
NR�gY�R�i����gffffff$@gffffff'@i8���Rs*-to value must be greater than -from value(RRFRR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_to�s
cCs||j�}|j|dd�|j|dd�|j|dd
dd�|j|dddd�|j|dd�dS(NR�R"smon tue wed thurtmonttuetwedtthurRoi*g��Q�	@s
any strings42 3.14 {} {any string}(RR	R
R(i*g��Q�	@R"s
any string(RRRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_values�scCs |j�}|j|d�dS(NR�(RtcheckBooleanParam(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt	test_wrap�scCs�|j�}|j|jd��|jtj|jd�|jtj|jd�|jt|j�|jt|jdd�dS(Nitnoindexi(RtassertIsBoundingBoxtbboxR�R@RR�t	TypeError(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt	test_bbox�scCsl|j�}|j|j�d�|jd�|j|j�d�|jd�|j|j�d�dS(NR�tbuttonupt
buttondown(RRtselection_element(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_selection_element�s

(,RzR1R2R�R�R�R�R�R3R�RR�RWRXR�R�R5R6R7R�R�R�R�R�R�R�R�R;R�R�R�R�R�R�R�R=R�R�R�R�R�R?R�R�N(RR.RSRR�R�R�R�RRRRRRRRRR(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�zs8												tTextTestc)Bs1eZd@ZedAkr!eZnd+�Zd,�Zed)d*�d-��Z	ed)d*�d.��Z
d/�Zd0�Zed)d*�d1��Z
ed)d2�d3��Zd4�Zd5�Zd6�Zd7�Zed)d*�d8��Zd9�Zd:�Zed)d*�d;��Zd<�Zd=�Zd>�Zd?�ZRS(BtautoseparatorsR1tblockcursorR2R3tendlineR�RWRXR4R5R6R7tinactiveselectbackgroundR�R�R�R�tinsertunfocussedR�tmaxundoR9R:R;R�R�R�tsetgridtspacing1tspacing2tspacing3t	startlineR�ttabsttabstyleR=tundoR?R�R�tyscrollcommandiicKstj|j|�S(N(R@tTextRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs |j�}|j|d�dS(NR(RR
(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_autoseparators�scCs |j�}|j|d�dS(NR(RR
(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_blockcursor�scCs�|j�}djd�td�D��}|jd|�|j|dddd�|j|dd	dd�|j|dd
dd�|j|dd
�|j|dd�|j|dddd�dS(Ns
css|]}dVqdS(sLine %dN((t.0ti((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pys	<genexpr>sidtendRi�RoR"i����R�Rsexpected integer but got "spam"i2R#ii
s1-startline must be less than or equal to -endline(RtjointrangetinsertRFR(RRR[((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_endlinescCs^|j�}|j|ddddd�|j|dddd�|j|dd	dd�dS(
NR4idg�����LY@gfffff�Y@t3ci����Roii(RRvRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs)|j�}|j|dddd�dS(NRiii����(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_maxundoscCs |j�}|j|d�dS(NR(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_inactiveselectbackgroundsicCs)|j�}|j|dddd�dS(NRthollowR�tsolid(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_insertunfocussedsc
Cs>|j�}|j|ddddddtdtd
k�dS(NR�g�������?g������@i����RuR�t	keep_origii(ii(RRvRR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_selectborderwidth$scCsE|j�}|j|ddddd�|j|dddd�dS(	NR igffffff5@g������6@s0.5ci����Roi(RRvRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_spacing1*scCsE|j�}|j|ddddd�|j|dddd�dS(	NR!ig������@gffffff@s0.1ci����Roi(RRvRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_spacing2/scCsE|j�}|j|ddddd�|j|dddd�dS(	NR"igffffff5@g������6@s0.5ci����Roi(RRvRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_spacing34scCs�|j�}djd�td�D��}|jd|�|j|dddd�|j|dd	dd�|j|dd
dd�|j|dd
�|j|dd�|j|dddd�dS(Ns
css|]}dVqdS(sLine %dN((R+R,((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pys	<genexpr><sidR-R#i�RoR"i����R�Rsexpected integer but got "spam"i
Ri2iFs1-startline must be less than or equal to -endline(RR.R/R0RFR(RRR[((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_startline9scCsK|j�}tdkr1|j|ddd�n|j|ddd�dS(NiiR�R�R�(ii(RRR�Rj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�Gsc
Cs�|j�}t�dkr7|j|ddd	d�n|j|dd�|j|ddd	d�|j|dd
d	d�|j|dddddtdk�dS(NiiiR$gffffff$@g33333�4@t1it2iRos10.2s20.7s10.2 20.7 1i 2is2c left 4c 6c centert2cR�t4ct6cRiR�Rsbad screen distance "spam"R8(iii(gffffff$@g33333�4@R>R?(s10.2s20.7R>R?(gffffff$@g33333�4@R>R?(s10.2s20.7R>R?(R@R�RARBRi(ii(RRRFRR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt	test_tabsNs
cCs&|j�}|j|ddd�dS(NR%ttabulart
wordprocessor(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_tabstyle]scCs |j�}|j|d�dS(NR&(RR
(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt	test_undobscCsU|j�}|j|dd�|j|dddd�|j|dddd�dS(NR?i�in���Roii(RR�RF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�fscCsQ|j�}tdkr4|j|dddd�n|j|dddd�dS(NiiR�tcharR�tword(ii(RRR�Rj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRlscCs�|j�}|j|jd��|j|jd��|jtj|jd�|jtj|jd�|jtj|j�|jtj|jdd�dS(Ns1.1R-R(RRRtassertIsNoneR�R@RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRss()RR1RR2R3RR�RWRXR4R5R6R7RR�R�R�R�RR�RR9R:R;R�R�R�RR R!R"R#R�R$R%R=R&R?R�R�R'(ii(RR.RSRR)t
_stringifyRR)RR*R1R�R3R4R7R9R:R;R<R=R�RCRFRGR�RR(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�sB														t
CanvasTestcBsheZd#Zee�ZeZd�Zd�Z	d�Z
d�Zd�Zd �Z
d!�Zd"�ZRS($R1R2tcloseenoughtconfineR3R4R5R6R7R�R�R�R�R�toffsetR;tscrollregionR�R�R�R�R=R�txscrollincrementR'tyscrollincrementR?cKstj|j|�S(N(R@tCanvasRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�sc	Cs2|j�}|j|ddddddt�dS(NRMig333333@g������@i����R�(RRtfloat(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_closeenough�scCs |j�}|j|d�dS(NRN(RR
(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_confine�scCs�|j�}|j|dd�|j|dddddddd	d
d�|j|dd�|j|dd
�|j|dd�dS(NROs0,0R`RaR]RdRcReRfRbRis10,20s#5,6R�(RRR�RFR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_offset�scCs�|j�}|j|dd�|j|dddd�|j|dd�|j|ddd	d
�|j|dd�|j|dd
�|j|dd�dS(NRPs0 0 200 150ii�i�RoR"R�Rsbad scrollRegion "spam"(iii�i�(iii�R�(iii�(iii�i�i(RRFR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_scrollregion�scCs,|j�}|j|ddddd�dS(NR�R�R�Rs0bad state value "{}": must be normal or disabled(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR��sc	Cs2|j�}|j|ddddddd�dS(NRQi(ig������D@g������E@i���s0.5i(RRv(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_xscrollincrement�sc	Cs2|j�}|j|ddddddd�dS(NRRi
igffffff&@g333333+@i����s0.1i(RRv(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_yscrollincrement�s(R1R2RMRNR3R4R5R6R7R�R�R�R�R�ROR;RPR�R�R�R�R=R�RQR'RRR?(RR.RSR�R
RxR)RKRRURVRWRXR�RYRZ(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRL}s(								tListboxTestcBs�eZd,Zd�Zd�Zeddd�ejj�Zd�Z	d�Z
d �Zd!�Zd"�Z
d#�Zd$�Zd%�Zd&�Zd'�Zd(�Zd)�Zd*�Zd+�ZRS(-tactivestyleR1R2R3RR�RWRXR4R5R6R7R�tlistvariableR;R�R�R�t
selectmodeRR�R=R?R�R'cKstj|j|�S(N(R@tListboxRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs)|j�}|j|dddd�dS(NR\tdotboxR�R�(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_activestyle�siiicCs5|j�}tj|j�}|j|d|�dS(NR](RR@t	DoubleVarRBtcheckVariableParam(RRtvar((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_listvariable�scCs\|j�}|j|dd�|j|dd�|j|dd�|j|dd�dS(NR^tsingletbrowsetmultipletextended(RRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_selectmode�s
cCs&|j�}|j|ddd�dS(NR�R�R�(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR��sc
Cs�|j�}|jtd��|jd�WdQXdj�}|jd|�x-t|�D]\}}|j|d|�q[W|jt��|j�WdQX|jtd��|jd�WdQX|j	|jdd�d�|j	|jdd�d�|j	|jdd�d�|jd�}|j
|t�x�|j�D]s\}}|j
t|�d�t|�d
krD|j	||jd|��|j	|d|jd|��qDqDWdS(Nsitem number "0" out of rangeis)red orange yellow green blue white violetR-R1sbad listbox index "red"tredt
BackgroundR"tviolets@0,0iii(R1R1RlR"Rk(R1R1RlR"Rm(R1R1RlR"Rk(ii(RtassertRaisesRegexpRt
itemconfiguretsplitR0t	enumerateR�RRtassertIsInstancetdicttitemstassertIntlentitemcget(RRtcolorsR,tcolortdtktv((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_itemconfigure�s0c	Cs�|j�}|jddddd�|jdi||6�|j|jd|�d|�|j|jd|�|�|jtd��|jdid	|6�WdQXdS(
NR-R�R�R�Rziisunknown color name "spam"R�(RR0RoRRwRnR(RRmR�R((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pytcheck_itemconfigures cCs|jdd�dS(NR1s#ff0000(R~(R((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_itemconfigure_backgroundscCs|jdd�dS(Ntbgs#ff0000(R~(R((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_itemconfigure_bgscCs|jdd�dS(Ntfgs#110022(R~(R((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_itemconfigure_fgscCs|jdd�dS(NRXs#110022(R~(R((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_itemconfigure_foregroundscCs|jdd�dS(NR�s#110022(R~(R((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt#test_itemconfigure_selectbackgroundscCs|jdd�dS(NR�s#654321(R~(R((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt#test_itemconfigure_selectforegroundscCs�|j�}|jdd�td�D��|j�|j|jd��|j|jd��|j|jd��|jt|jd�|jt|jd�|jt
|j�|jt
|jdd�dS(Nicss|]}d|VqdS(sel%dN((R+R,((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pys	<genexpr>sii����i
Ri(RR0R/tpackRRRJR�RR�R(Rtlb((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_boxs 
cCs�|j�}|jdd�td�D��|jdtj�|jdd�|jd�|j|j�d�|j	t
|jd�dS(	Nicss|]}d|VqdS(sel%dN((R+R,((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pys	<genexpr>+siiiii(iiii(RR0R/tselection_clearR@tENDt
selection_setRtcurselectionR�R(RR�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_curselection)s 
cCs�|j�}|jdd�td�D��|j|jd�d�|j|jd�d�|j|jd�d�|j|jd�d	�|j|jd
�d	�|j|jdd�d�|j|jdd�d�|j|jdd�d�|j|jdd�d�|jt|jd�|jt|jd�|jt|j�|jt|jdd�|jt|jddd�|jt|jd�dS(Nicss|]}d|VqdS(sel%dN((R+R,((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pys	<genexpr>4sitel0itel3R-tel7R"i����itel4tel5tel6Riig333333@(R�R�R�(R�R�R�((R�(	RR0R/RtgetR�RR�R(RR�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_get2s" (R\R1R2R3RR�RWRXR4R5R6R7R�R]R;R�R�R�R^RR�R=R?R�R'(RR.RSRRaRR
ttest_justifyR�ReRjR�R}R~RR�R�R�R�R�R�R�R�(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR[�s2																	t	ScaleTestcBs�eZd+ZdZd�Zd �Zd!�Zd"�Zd#�Zd$�Z	d%�Z
d&�Zd'�Zd(�Z
d)�Zd*�ZRS(,RzR1tbigincrementR2R�R3tdigitsRWRXR�R5R6R7RrtlengthtorientR;R�R�t
resolutiont	showvaluetsliderlengthtsliderreliefR�R=ttickintervalR�ttroughcolorR�R?tverticalcKstj|j|�S(N(R@tScaleRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRSscCs)|j�}|j|dddd�dS(NR�g������(@g������7@i����(RR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_bigincrementVscCs&|j�}|j|ddd�dS(NR�ii(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_digitsZscCs/|j�}|j|dddddt�dS(NR�idg������-@g333333.@R�(RRtround(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR^scCs6|j�}|j|dd�|j|dd�dS(NRrs
any stringR"(RRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_labelbscCs,|j�}|j|ddddd�dS(NR�i�gffffff`@g33333�`@t5i(RRv(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_lengthgscCs,|j�}|j|ddddd�dS(NR�g������@ig������@i����(RR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_resolutionkscCs |j�}|j|d�dS(NR�(RR
(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_showvalueoscCs/|j�}|j|dddddd�dS(NR�i
gffffff&@g333333/@i����t3m(RRv(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_sliderlengthsscCs |j�}|j|d�dS(NR�(RR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_sliderreliefxsc	CsQ|j�}|j|ddddddt�|j|dddd	dt�dS(
NR�ig333333@gffffff@iR�i����Roi(RRR�RF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_tickinterval|s
c	Cs2|j�}|j|ddddddt�dS(NR�i,g������-@g333333.@i����R�(RRR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�s(RzR1R�R2R�R3R�RWRXR�R5R6R7RrR�R�R;R�R�R�R�R�R�R�R=R�R�R�R�R?(RR.RStdefault_orientRR�R�RR�R�R�R�R�R�R�R(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�Fs(											t
ScrollbarTestcBs\eZdZee�ZeZdZd�Z	d�Z
d�Zd�Zd�Z
d�ZRS(RztactivereliefR1R2R�R3telementborderwidthR5R6R7tjumpR�R;R�R�R=R�R?R�cKstj|j|�S(N(R@t	ScrollbarRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs |j�}|j|d�dS(NR�(RR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_activerelief�scCs,|j�}|j|ddddd�dS(NR�g333333@gffffff@i����t1m(RRv(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_elementborderwidth�scCs,|j�}|j|ddddd�dS(NR�R�t
horizontalRs4bad orientation "{}": must be vertical or horizontal(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_orient�scCsg|j�}xdD]}|j|�qW|jd�|jt|j�|jt|jdd�dS(Ntarrow1tslidertarrow2R"(R�R�R�(RtactivateR�R(RtsbR]((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_activate�s

cCs�|j�}|jdd�|j|j�d�|jt|jdd�|jt|jdd�|jt|jdd�|jt|jd�|jt|jddd�dS(	Ng�������?g�������?tabctdefg333333�?gffffff�?g�������?(g�������?g�������?(RtsetRR�R�RR�(RR�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_set�s(RzR�R1R2R�R3R�R5R6R7R�R�R;R�R�R=R�R?(RR.RSR�R
RxR)RKR�RR�R�R�R�R�(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR��s 					tPanedWindowTestcBsgeZd2ZdZd�Zd�Zd�Zd�Zd�Ze	ddd�d��Z
e	ddd�d��Ze	ddd�d��Zd�Z
d�Zd �Zd!�Zd"�Zd#�Zd$�Zd%�Zed&�Zd'�Zd(�Zd)�Zd*�Ze	dd�d+��Zd,�Zd-�Zd.�Zd/�Ze	dd�d0��Z d1�Z!RS(3R1R2R3t	handlepadt
handlesizeR4topaqueresizeR�tproxybackgroundtproxyborderwidthtproxyreliefR;t
sashcursortsashpadt
sashrelieft	sashwidtht
showhandleR?R�cKstj|j|�S(N(R@tPanedWindowRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs/|j�}|j|dddddd�dS(NR�ig������@gffffff@i����R�(RRv(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_handlepad�sc
Cs5|j�}|j|dddddddt�dS(NR�ig������"@g333333%@i����t2mR�(RRvR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_handlesize�scCs8|j�}|j|ddddddddt�dS(	NR4idg�����LY@gfffff�Y@i����iR>R�(RRvR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR��s!cCs |j�}|j|d�dS(NR�(RR
(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_opaqueresize�siiicCs |j�}|j|d�dS(NR�(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_proxybackground�scCs8|j�}|j|ddddddddt�dS(	NR�ig�������?g333333@ii����RuR�(RRvR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_proxyborderwidth�scCs |j�}|j|d�dS(NR�(RR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_proxyrelief�scCs |j�}|j|d�dS(NR�(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_sashcursor�scCs/|j�}|j|dddddd�dS(NR�ig�������?g������@i����R�(RRv(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_sashpad�scCs |j�}|j|d�dS(NR�(RR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_sashrelief�sc
Cs5|j�}|j|dddddddt�dS(NR�i
g333333&@g333333/@i����R�R�(RRvR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_sashwidth�scCs |j�}|j|d�dS(NR�(RR
(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_showhandle�scCs8|j�}|j|ddddddddt�dS(	NR?i�gfffff6y@g�����Iy@in���iR�R�(RRvR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�s!cCsQ|j�}tj|�}tj|�}|j|�|j|�|||fS(N(RR@R�tadd(RtpR�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pytcreate2s

cCs�|j�\}}}|jt|j�|j|�}|j|t�xl|j�D]^\}}|jt|�d�|j||j||��|j|d|j	||��qTWdS(Nii(
R�R�Rt
paneconfigureRrRsRtRRvtpanecget(RR�R�R�RzR{R|((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigurescCs�d�}|js|r(t|�}n|jr@|r@t}n|j|i||6�|j||j||�d�|�|j||j||��|�dS(NcSs|S(N((tx((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt<lambda>R"i(R(R�R�RR�(RR�R�RmR�Rot	stringifyR�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pytcheck_paneconfigures		&c	Cs4|jt|��|j|id|6�WdQXdS(NtbadValue(RnRR�(RR�R�Rmtmsg((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pytcheck_paneconfigure_bad$scCsN|j�\}}}|j||d|t|��|j||dd�dS(Ntaftersbad window path name "badValue"(R�R�R�R�(RR�R�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigure_after(scCsN|j�\}}}|j||d|t|��|j||dd�dS(Ntbeforesbad window path name "badValue"(R�R�R�R�(RR�R�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigure_before.scCsW|j�\}}}|j||ddddt�dk�|j||dd�dS(	NR4i
R�iiisbad screen distance "badValue"(iii(R�R�RR�(RR�R�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigure_height4s
cCsH|j�\}}}|j||dtd�|j||dd�dS(Nthideis)expected boolean value but got "badValue"(R�R�tFalseR�(RR�R�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigure_hide;scCsH|j�\}}}|j||ddd�|j||dd�dS(Ntminsizei
sbad screen distance "badValue"(R�R�R�(RR�R�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigure_minsizeBscCsH|j�\}}}|j||ddd�|j||dd�dS(NR9g�������?isbad screen distance "badValue"(R�R�R�(RR�R�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigure_padxHscCsH|j�\}}}|j||ddd�|j||dd�dS(NR:g�������?isbad screen distance "badValue"(R�R�R�(RR�R�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigure_padyNscCsH|j�\}}}|j||ddd�|j||dd�dS(Ntstickytnsewtnesws[bad stickyness value "badValue": must be a string containing zero or more of n, e, s, and w(R�R�R�(RR�R�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigure_stickyTscCsH|j�\}}}|j||ddd�|j||dd�dS(NtstretchtalwtalwayssEbad stretch "badValue": must be always, first, last, middle, or never(R�R�R�(RR�R�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigure_stretch\scCsW|j�\}}}|j||ddddt�dk�|j||dd�dS(	NR?i
R�iiisbad screen distance "badValue"(iii(R�R�RR�(RR�R�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigure_widthds
(R1R2R3R�R�R4R�R�R�R�R�R;R�R�R�R�R�R?("RR.RSR�RR�R�R�R�RR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR��sH													

								tMenuTestcBseeZdZeZd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
RS(RztactiveborderwidthR{R1R2R3RRWRXtpostcommandR;R�R=ttearoffttearoffcommandRttypecKstj|j|�S(N(R@RERB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRwscCs |j�}|j|d�dS(NR(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_postcommandzscCs |j�}|j|d�dS(NR(RR
(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_tearoff~scCs |j�}|j|d�dS(NR(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_tearoffcommand�scCs#|j�}|j|dd�dS(NRs
any string(RRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_title�scCs)|j�}|j|dddd�dS(NRR�Rtmenubar(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt	test_type�scCs	|j�}|jdd�|jt|j�|jtd��|jd�WdQX|jd�}|j|t�x�|j	�D]v\}}|j|t
�|j|t�|jt
|�d�|j|d|�|j|jd|�|d�q�W|j�dS(	NRrttestsbad menu entry index "foo"Rniiii(Rtadd_commandR�RtentryconfigureRnRRrRsRtR�ttupleRRvt	entrycgetRq(Rtm1RzR{R|((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_entryconfigure�s$cCsk|j�}|jdd�|j|jdd�d�|jddd�|j|jdd�d�dS(NRrR
itchanged(RRRRR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_entryconfigure_label�s
c	Cs�|j�}tj|j�}tj|j�}|jd|dtdtdd�|jt|j	dd��t|��|j
dd|�|jt|j	dd��t|��dS(NR�R�R�RrtNonsensei(RR@t
BooleanVarRBtadd_checkbuttonR)R�RR�RR(RRtv1tv2((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_entryconfigure_variable�s((RzRR{R1R2R3RRWRXRR;R�R=RRRR(RR.RSR	RxRRRR	R
RRRR(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRls								tMessageTestcBs&eZdZeZd�Zd�ZRS(R|taspectR1R2R3RWRXR5R6R7R�R9R:R;R=R[R�R?cKstj|j|�S(N(R@tMessageRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs)|j�}|j|dddd�dS(NRi�ii���(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_aspect�s(R|RR1R2R3RWRXR5R6R7R�R9R:R;R=R[R�R?(RR.RSR	R/RR(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�s	t__main__(1R�tTkinterR@RRIR�ttest.test_supportRRttest_ttk.supportRRRRtwidget_testsRRR	R
RRR
RRRRtTestCaseR0RTRVRtRyR�R�R�R�R�R�R�RRLR[R�R�R�RRt	tests_guiR(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt<module>sl"F
%(	AEh�B�B1�Dtest_tkinter/test_loadtk.pyc000064400000003314150351526620012323 0ustar00�
zfc@s�ddlZddlZddlZddlmZddlmZmZejd�dej	fd��YZ
e
fZedkr�ej
e�ndS(i����N(ttest_support(tTcltTclErrortguit
TkLoadTestcBs5eZejdejkd�d��Zd�ZRS(tDISPLAYsNo $DISPLAY set.cCsJt�}|jt|j�|j�|jd|j��|j�dS(Ns1x1+0+0(RtassertRaisesRtwinfo_geometrytloadtktassertEqualtdestroy(tselfttcl((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_loadtk.pyt
testLoadTks
	
cCs�d}tjjd�rdStj��t}dtjkri|d=tjd�j	�j
�}|ridSnt�}|jt
|j�|jt
|j�WdQXdS(NtwintdarwintcygwinRs
echo $DISPLAY(RRR(tNonetsystplatformt
startswithRtEnvironmentVarGuardtostenvirontpopentreadtstripRRRRR(Rtold_displaytenvtdisplayR((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_loadtk.pyttestLoadTkFailures	(t__name__t
__module__tunittesttskipIfRRR
R(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_loadtk.pyR	s$t__main__(RRR!ttestRtTkinterRRtrequirestTestCaseRt	tests_guiRtrun_unittest(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_loadtk.pyt<module>s
!	test_tkinter/test_geometry_managers.pyo000064400000120324150351526620014572 0ustar00�
zfc@sddlZddlZddlZddlmZddlmZmZddlm	Z	m
Z
mZddlm
Z
mZed�de
ejfd��YZd	e
ejfd
��YZde
ejfd��YZeeefZed
kree�ndS(i����N(tTclError(trequirestrun_unittest(tpixels_convttcl_versiontrequires_tcl(tAbstractWidgetTestt	int_roundtguitPackTestcBs�eZd
Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�ZRS(c
Cs�tj|jdd�}|jd�|jdd�tj|dddddd	d
d�}tj|dddd
ddd
d�}tj|ddddddd
d�}tj|dddd	ddd
d�}|||||fS(Ntnametpacks300x200+0+0itatwidthitheighti(tbgtredtbi2itbluetciPtgreentdtyellow(ttkintertTopleveltroottwm_geometryt
wm_minsizetFrame(tselfRRRRR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pytcreate2s
''''cCs;|j�\}}}}}|jtd|��|jd|�WdQX|jtd��|jdd�WdQX|jdd�|jdd�|jdd�|jdd�|j|j�||||g�|jd|�|j|j�||||g�|jd|�|j|j�||||g�dS(Nswindow "%s" isn't packedtaftersbad window path name ".foo"s.footsidettop(RtassertRaisesRegexpRtpack_configuretassertEqualtpack_slaves(RRRRRR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_pack_configure_afters""cs��j�\}�}}}��fd�}|dd�|dd�|dd�|dd	�|d
d�|dd
�|dd�|dd�|dd�dS(Ncs[�jddddddddd	d
dtd|��jj��j�j�|�dS(
NR R!tipadxitpadxi
tipadyitpadyitexpandtanchor(R#tTrueRtupdateR$twinfo_geometry(R,tgeom(RR(sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pytcheck-s'

tns30x70+135+20tnes30x70+260+20tes30x70+260+65tses
30x70+260+110tss
30x70+135+110tsws30x70+10+110tws30x70+10+65tnws30x70+10+20tcenters30x70+135+65(R(RRRRRR1((RRsG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_pack_configure_anchor+s







cCs;|j�\}}}}}|jtd|��|jd|�WdQX|jtd��|jdd�WdQX|jdd�|jdd�|jdd�|jdd�|j|j�||||g�|jd|�|j|j�||||g�|jd|�|j|j�||||g�dS(Nswindow "%s" isn't packedtbeforesbad window path name ".foo"s.fooR R!(RR"RR#R$R%(RRRRRR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_pack_configure_before<s""cs{�j�\}���������fd�}�jdd��jdd��jdd��jdd�|ddd	d
��jdddd��jdddd
��jdddt��jdddd�|dddd��jdddddd��jdddd
dd��jdddtdd��jdddddd�|dddd�dS(Ncsy�jj��j�j�|d��j�j�|d��j�j�|d��j�j�|d�dS(Niiii(RR.R$R/(tgeoms(RRRRR(sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyR1Ns

R tleftR!trighttbottoms
20x40+0+80s50x30+135+0s80x80+220+75s
40x30+100+170R+tyestonis20x40+40+80s50x30+175+35s
80x80+180+110s
40x30+100+135tfilltboths100x200+0+0s
200x100+100+0s160x100+140+100s40x100+100+100(RR#R-(RRR1((RRRRRsG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_pack_configure_expandLs"cCs2|j�\}}}}}|jdd�|jdd�|jdd�|jdd�|jd|�|j|j�||||g�|jd|�|j|j�|||g�|j|j�|g�|jtd|f��|jd|�WdQX|jtd��|jdd�WdQXdS(NR R!tin_scan't pack %s inside itselfsbad window path name ".foo"s.foo(RR#R$R%R"R(RRRRRR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_pack_configure_inds"	cs��j�\}��}}���fd�}|dddddd�|dddddd'�|dddddd�|d
ddddddd	�|dddddddd�|dddddd(dd�|dddddddd�|d
ddddddd	dd�|dddddddd)dd�|dddddd�|dddddd*�|dddddd�|dddddddd	�|dddddddd+�|d ddddddd�|d!ddddd,dd�|d#ddddddd�|d$ddddddd	dd�|d%ddddddd-dd��jdd&��j�j�d�j|jd&����jdd&��j�j�d�j|jd&���dS(.Ncst�j��j��j|��jdtdd��jj��j�j�|��j�j�|�dS(NR+RDRE(tpack_forgetR#R-RR.R$R/(tgeom1tgeom2tkwargs(RRR(sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyR1ws



s20x40+260+80s240x200+0+0R R@R(is20x40+250+80i
is60x40+240+80R's30x40+260+80s250x200+0+0iRDtxs20x40+249+80i	is30x40+255+80is20x40+140+0s300x160+0+40R!s20x40+120+0ii(s60x40+120+0s30x40+135+0s30x40+130+0s260x40+20+0s260x40+25+0is
300x40+0+0s280x40+10+0s
280x40+5+0t1c(i
i(i	i(ii(ii((ii(ii(ii(RR#R$t	pack_infot_strtwinfo_pixels(RRRRR1((RRRsG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyt#test_pack_configure_padx_ipadx_fillusBcs��j�\}��}}���fd�}|dddddd�|dddddd'�|dddddd�|d
ddddddd	�|dddddddd�|dddddd(dd�|dddddddd�|d
ddddddd	dd�|dddddddd)dd�|dddddd�|dddddd*�|dddddd�|dddddddd	�|dddddddd+�|d ddddddd�|d!ddddd,dd�|d#ddddddd�|d$ddddddd	dd�|d%ddddddd-dd��jdd&��j�j�d�j|jd&����jdd&��j�j�d�j|jd&���dS(.Ncst�j��j��j|��jdtdd��jj��j�j�|��j�j�|�dS(NR+RDRE(RIR#R-RR.R$R/(RJRKRL(RRR(sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyR1�s



s20x40+280+80s280x200+0+0R R@R*is20x40+280+70i
is20x80+280+60R)s20x50+280+75iRDRMs20x40+280+69i	is20x50+280+70is20x40+140+20s300x120+0+80R!s20x40+140+0ii(s20x80+140+0s20x50+140+10s300x130+0+70s20x50+140+5s300x40+0+20s300x40+0+25is
300x80+0+0s300x50+0+10s
300x50+0+5RN(i
i(i	i(ii(ii((ii(ii(ii(RR#R$RORPRQ(RRRRR1((RRRsG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyt#test_pack_configure_pady_ipady_fill�sBcst�j�\}��}}���fd�}|ddd�|ddd�|dd	d
�|ddd
�dS(Ncs}�jd|��j�j�d|��jdtdd��jj��j�j�|��j�j�|�dS(NR R+RDRE(R#R$ROR-RR.R/(R RJRK(RRR(sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyR1�s
R!s20x40+140+0s300x160+0+40RAs
20x40+140+160s300x160+0+0R?s
20x40+0+80s280x200+20+0R@s20x40+280+80s280x200+0+0(R(RRRRR1((RRRsG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_pack_configure_side�scCs�|j�\}}}}}|j�|j�|j�|j|j�|||g�|j�|j|j�||g�|j�|j|j�||g�|j�dS(N(RR#R$R%RI(RRRRRR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_pack_forget�s




cCs�|j�\}}}}}|jtd|��|j�WdQX|j�|jddd|dddtdd	d
ddd
dddd�	|j�}|j|t�|j|dd�|j|d|j	d��|j|dd�|j|d|�|j|d
|j	d��|j|d|j	d��|j|d|j	d��|j|d|j	d��|j|dd�|j�}|j|t�|j|dd�|j|d|j	d��|j|dd	�|j|d|�|j|d
|j	d��|j|d|j	d��|j|d|j	d
��|j|d|j	d��|j|dd�dS(Nswindow "%s" isn't packedR R@RGR,R6R+RDRMR'iR(i
R)iR*iR:itnonetinR!i(ii(ii(
RR"RROR#R-tassertIsInstancetdictR$RP(RRRRRRtinfo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_pack_info�s8
'cCs�|j�\}}}}}|jdddd�|j�|jt�|jj�|j|j�d�|j|j	�d�|jt
�|jj�|j|j�d�|j|j	�d�dS(NR
i,Ri�ii((Rt	configureR#tpack_propagatetFalseRR.R$twinfo_reqwidthtwinfo_reqheightR-(RRRRRR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_pack_propagates




cCs~|j�\}}}}}|j|j�g�|j�|j|j�|g�|j�|j|j�||g�dS(N(RR$R%R#(RRRRRR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_pack_slavess

N(t__name__t
__module__tNonet	test_keysRR&R;R=RFRHRRRSRTRUR[RaRb(((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyR	
s	
						*	*				
t	PlaceTestcBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�ZRS(c
Cs�tj|jdddddd�}|jd�tj|dddd	dd
dd�}|jd
ddd�tj|dddddd
dd�}|jj�|||fS(NR
i,Ri�tbdis300x200+0+0i�iTitrelieftraisedRMi0tyi&ii<(RRRRRtplace_configureR.(Rtttftf2((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyRs$
''
cCs�|j�\}}}|j|j�d�|jtdtjt|����|jd|�WdQXt	d	kr�|j|j�d�n|jtd��|jdd�WdQX|jd|�|j|j�d�dS(
Nts!can't place %s relative to itselfRGiisbad window path nametspamtplace(ii(
RR$t
winfo_managerR"RtretescapetstrRlR(RRmRnRo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_in$sc	Cs5|j�\}}}|jd|�|j|j�dd�|jj�|j|j�d�|jdd�|j|j�dd�|jj�|j|j�d�|jddd	d
�|j|j�dd�|jj�|j|j�d�|jtd
��|jd|dd�WdQXdS(NRGRMt0i2idt100i�i����trelxis-10i�sbad screen distance "spam"Rq(	RRlR$t
place_infoRR.twinfo_xR"R(RRmRnRo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_x1s


c	Cs5|j�\}}}|jd|�|j|j�dd�|jj�|j|j�d�|jdd�|j|j�dd�|jj�|j|j�d�|jddd	d
�|j|j�dd�|jj�|j|j�d�|jtd
��|jd|dd�WdQXdS(NRGRkRxi(i2t50iZi����trelyis-10insbad screen distance "spam"Rq(	RRlR$R{RR.twinfo_yR"R(RRmRnRo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_yBs


c	Cs/|j�\}}}|jd|�|j|j�dd�|jj�|j|j�d�|jdd�|j|j�dd�|jj�|j|j�d�|jdd�|j|j�dd	�|jj�|j|j�d
�|jtd��|jd|dd�WdQXdS(
NRGRzRxi2g�?s0.5i}it1i�s-expected floating-point number but got "spam"Rq(	RRlR$R{RR.R|R"R(RRmRnRo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_relxSs


c	Cs/|j�\}}}|jd|�|j|j�dd�|jj�|j|j�d�|jdd�|j|j�dd�|jj�|j|j�d�|jdd�|j|j�dd	�|jj�|j|j�d
�|jtd��|jd|dd�WdQXdS(
NRGRRxi(g�?s0.5iPiR�ixs-expected floating-point number but got "spam"Rq(	RRlR$R{RR.R�R"R(RRmRnRo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_relyes


cCs�tj|j�}|jtd��|jdd�WdQX|jtd��|jdd�WdQXx8dD]0}|jd|�|j|j�d|�qkWdS(Nsbad anchor "j"R,tjsambiguous anchor ""RpR2R3R4R5R6R7R8R9R:(	R2R3R4R5R6R7R8R9R:(RRRR"RRlR$R{(RRntvalue((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_anchorws
cCs�|j�\}}}|jd|dd�|jj�|j|j�d�|jdd�|jj�|j|j�d�|jtd��|jdd�WdQXdS(NRGR
ixRpisbad screen distance "abcd"tabcd(RRlRR.R$twinfo_widthR"R(RRmRnRo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_width�s

cCs�|j�\}}}|jd|dd�|jj�|j|j�d�|jdd�|jj�|j|j�d�|jtd��|jdd�WdQXdS(NRGRixRpi<sbad screen distance "abcd"R�(RRlRR.R$twinfo_heightR"R(RRmRnRo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_height�s

cCs�|j�\}}}|jd|dd�|jj�|j|j�d�|jdd�|jj�|j|j�d�|jtd��|jdd�WdQXdS(	NRGtrelwidthg�?iKRpis-expected floating-point number but got "abcd"R�(RRlRR.R$R�R"R(RRmRnRo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_relwidth�s

cCs�|j�\}}}|jd|dd�|jj�|j|j�d�|jdd�|jj�|j|j�d�|jtd��|jdd�WdQXdS(	NRGt	relheightg�?i(Rpi<s-expected floating-point number but got "abcd"R�(RRlRR.R$R�R"R(RRmRnRo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_relheight�s

cCs�tj|j�}|jtd��|jdd�WdQX|jtd��|jdd�WdQXx8d	D]0}|jd|�|j|j�d|�qkWdS(
Nsbad bordermode "j"t
bordermodeR�sambiguous bordermode ""Rptinsidetoutsidetignore(R�R�R�(RRRR"RRlR$R{(RRnR�((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_configure_bordermode�s
cCs�tj|j�}|jdddd�|jj�|j�|jj�|j|j��|jt	��|jd�WdQXdS(NR
i2Ri(
RRRRlR.tplace_forgettassertFalsetwinfo_ismappedtassertRaisest	TypeError(Rtfoo((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_forget�s


cCs�|j�\}}}|jd|dddddddd	d
ddd
dddddddd�|j�}|j|t�|j|dd�|j|dd�|j|dd�|j|dd�|j|d
d�|j|dd�|j|dd�|j|dd�|j|dd�|j|dd�|j|dd�|j|dd�|jt��|jd�WdQXdS(NRGRMiRkiR
iRiRzg�������?Rg�������?R�g333333�?R�g�������?R,R5R�R�R�t2t3t4s0.1s0.2s0.3s0.4i(RRlR{RXRYR$R�R�(RRmRnRoRZ((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_info�s('
cCs�tj|j�}tj|j�}|j|j�g�|jd|�|j|j�|g�|jt��|jd�WdQXdS(NRGi(RRRR$tplace_slavesRlR�R�(RR�tbar((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_place_slaves�sN(RcRdReRfRRwR}R�R�R�R�R�R�R�R�R�R�R�R�(((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyRgs 			
					
					
	
	tGridTestcBseZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!RS(cCs�|jj�\}}x@t|d�D].}|jj|dddddddd�q&Wx@t|d�D].}|jj|dddddddd�qiW|jjd�tt|�j�dS(NitweightitminsizetpadtuniformRp(	Rt	grid_sizetrangetgrid_columnconfiguretgrid_rowconfiguretgrid_propagatetsuperR�ttearDown(Rtcolstrowsti((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyR��s,,cCs�tj|j�}|j|j�i�|j�|j|j�d|j�|j|j�d|jd��|j|j�d|jd��|jidd6dd�|j|j�d|jd��|j|j�d|jd��dS(NRWtcolumnitrowii(RtButtonRR$t	grid_infotgrid_configureRP(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure�s
###cCsrtj|j�}|jtd��|jdd�WdQX|jdd�|j|j�d|jd��dS(Ns5bad column value "-1": must be a non-negative integerR�i����i(	RR�RR"RR�R$R�RP(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure_column�s
cCsrtj|j�}|jtd��|jdd�WdQX|jdd�|j|j�d|jd��dS(Ns4bad columnspan value "0": must be a positive integert
columnspanii(	RR�RR"RR�R$R�RP(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure_columnspans
cCs�tj|j�}tj|j�}|j|j�i�|j�|j|j�d|j�|jd|�|j|j�d|�|ji|jd6�|j|j�d|j�dS(NRWRG(RRRR�R$R�R�(RRnR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure_ins
cCs�tj|j�}|jtd��|jdd�WdQX|jdd�|j|j�d|jd��|jdd�|j|j�d|jt	t
d�|j���dS(Ns6bad ipadx value "-1": must be positive screen distanceR'i����is.5c(RR�RR"RR�R$R�RPRRtscaling(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure_ipadxs#cCs�tj|j�}|jtd��|jdd�WdQX|jdd�|j|j�d|jd��|jdd�|j|j�d|jt	t
d�|j���dS(Ns6bad ipady value "-1": must be positive screen distanceR)i����is.5c(RR�RR"RR�R$R�RPRRR�(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure_ipady!s#cCs�tj|j�}|jtd��|jdd�WdQX|jdd�|j|j�d|jd��|jdd�|j|j�d|jd	��|jdd�|j|j�d|jt	t
d�|j���dS(
Ns4bad pad value "-1": must be positive screen distanceR(i����ii
is.5c(i
i(i
i(RR�RR"RR�R$R�RPRRR�(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure_padx,s##cCs�tj|j�}|jtd��|jdd�WdQX|jdd�|j|j�d|jd��|jdd�|j|j�d|jd	��|jdd�|j|j�d|jt	t
d�|j���dS(
Ns4bad pad value "-1": must be positive screen distanceR*i����ii
is.5c(i
i(i
i(RR�RR"RR�R$R�RPRRR�(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure_pady9s##cCsrtj|j�}|jtd��|jdd�WdQX|jdd�|j|j�d|jd��dS(Ns9bad (row|grid) value "-1": must be a non-negative integerR�i����i(	RR�RR"RR�R$R�RP(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure_rowFs
cCsrtj|j�}|jtd��|jdd�WdQX|jdd�|j|j�d|jd��dS(Ns1bad rowspan value "0": must be a positive integertrowspanii(	RR�RR"RR�R$R�RP(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure_rownspanNs
cCs�tj|jdd�}|jtd��|jdd�WdQX|jdd�|j|j�dd�|jdd�|j|j�dd�dS(	NRRsbad stickyness value "glue"tstickytglueR3sn,s,e,wtnesw(RRRR"RR�R$R�(RRn((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_configure_stickyVsc	Cs�|jt��|jj�WdQX|j|jjd�idd6dd6dd6dd6�|jtd��|jjdd�WdQX|jjddd	�|jtd
��|jjd�WdQXtj	|j�}|j
dddd�tdkr[|jjddd�|jtd��|jjd�WdQX|j|jjdd�d�n|j|jjdd�d	�|j|jjdd�d�tdkr�|jj|dd�|j|jjdd�d�ndS(NiR�R�R�R�sbad option "-foo"R�iis*must specify a single element on retrievalR�R�iitallsexpected integer but got "all"i	i(ii(ii(ii(ii(R�R�RR�R$ReR"RRR�R�R(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_columnconfigure_s,#	
"cCs�|jtd��|jjddd�WdQX|jjddd�|j|jjdd�d�|j|jjd�dd�dS(Nsbad screen distance "foo"iR�R�i
(R"RRR�R$(R((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyt!test_grid_columnconfigure_minsizews
c	Cs�|jtd��|jjddd�WdQX|jtd��|jjddd�WdQX|jjddd�|j|jjdd�d�|j|jjd�dd�dS(Nsexpected integer but got "bad"iR�tbads-invalid arg "-weight": should be non-negativei����i(R"RRR�R$(R((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyt test_grid_columnconfigure_weight~sc	Cs�|jtd��|jjddd�WdQX|jtd��|jjddd�WdQX|jjddd�|j|jjdd�d�|j|jjd�dd�dS(Nsbad screen distance "foo"iR�R�s*invalid arg "-pad": should be non-negativei����i(R"RRR�R$(R((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_columnconfigure_pad�scCsY|jjddd�|j|jjdd�d�|j|jjd�dd�dS(NiR�R�(RR�R$(R((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyt!test_grid_columnconfigure_uniform�sc	Cs�|jt��|jj�WdQX|j|jjd�idd6dd6dd6dd6�|jtd��|jjdd�WdQX|jjddd	�|jtd
��|jjd�WdQXtj	|j�}|j
dddd�tdkr[|jjddd�|jtd��|jjd�WdQX|j|jjdd�d�n|j|jjdd�d	�|j|jjdd�d�tdkr�|jj|dd�|j|jjdd�d�ndS(NiR�R�R�R�sbad option "-foo"R�iis*must specify a single element on retrievalR�R�iiR�sexpected integer but got "all"i	i(ii(ii(ii(ii(R�R�RR�R$ReR"RRR�R�R(RR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_rowconfigure�s,#	
"cCs�|jtd��|jjddd�WdQX|jjddd�|j|jjdd�d�|j|jjd�dd�dS(Nsbad screen distance "foo"iR�R�i
(R"RRR�R$(R((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_rowconfigure_minsize�s
c	Cs�|jtd��|jjddd�WdQX|jtd��|jjddd�WdQX|jjddd�|j|jjdd�d�|j|jjd�dd�dS(Nsexpected integer but got "bad"iR�R�s-invalid arg "-weight": should be non-negativei����i(R"RRR�R$(R((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_rowconfigure_weight�sc	Cs�|jtd��|jjddd�WdQX|jtd��|jjddd�WdQX|jjddd�|j|jjdd�d�|j|jjd�dd�dS(Nsbad screen distance "foo"iR�R�s*invalid arg "-pad": should be non-negativei����i(R"RRR�R$(R((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_rowconfigure_pad�scCsY|jjddd�|j|jjdd�d�|j|jjd�dd�dS(NiR�R�(RR�R$(R((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_rowconfigure_uniform�scCs�tj|j�}tj|j�}|jdddddddddddd	d
d�|j|jj�|g�|j�|j�|j|jj�g�|j|j�i�|jdddd�|j�}|j|d|jd��|j|d|jd��|j|d|jd
��|j|d|jd
��|j|d|jd��|j|d|jd��|j|d
d�dS(NR�iR�R�R�R(iR*iR�tnsiiRp(	RR�RR�R$tgrid_slavestgrid_forgetR�RP(RRRRZ((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_forget�s$!

cCs�tj|j�}tj|j�}|jdddddddddddd	d
d�|j|jj�|g�|j�|j�|j|jj�g�|j|j�i�|jdddd�|j�}|j|d|jd��|j|d|jd��|j|d|jd��|j|d|jd��|j|d|jd��|j|d|jd	��|j|d
d�dS(
NR�iR�R�R�R(iR*iR�R�i(	RR�RR�R$R�tgrid_removeR�RP(RRRRZ((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_remove�s$!

cCsUtj|j�}|j|j�i�|jdddddddddddd	d
d�|j�}|j|t�|j|d|j�|j|d|jd��|j|d|jd��|j|d|jd��|j|d|jd��|j|d|jd��|j|d|jd	��|j|d
d�dS(
NR�iR�R�R�R(iR*iR�R�RW(	RR�RR$R�R�RXRYRP(RRRZ((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_info�s!cCs�|j|jj�d�|j|jjdd�d�|j|jjdddd�d�|jtd��|jjdd�WdQX|jtd��|jjdd�WdQX|jtd��|jjdddd�WdQX|jtd��|jjdddd�WdQX|jt��!|jjddddd�WdQX|j}|jd�|jd�tj	|ddd	dd
d�}tj	|ddd	dd
d
�}|j
dddd�|j
dddd�|jj�|j|j�d�|j|jdd�d�|j|jdddd�d�|j|jdd�d�|j|jdddd�d�|j|jdddd�d�|j|jdddd�d�dS(Niisexpected integer but got "x"RMs1x1+0+0RpR
iKRRRiZRR�R�i�i
i����i����i(iiii(iiii(iiii(iii�i�(iiiKiK(iii�i�(iKiKiZiZ(iii�i�(iiii(i�i�ii(R$Rt	grid_bboxR"RR�R�RRRR�R.(RRmtf1Ro((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_bboxs8%"	

!!
"""cCs�|jt��|jj�WdQX|jt��|jjd�WdQX|jt��|jjddd�WdQX|jtd��|jjdd�WdQX|jtd��|jjdd�WdQX|j}|jd�|jd�tj|d	d
ddd
ddd�}|j	|jdd�d�|j
�|jj�|j	|jdd�d�|j	|jdd�d�|j	|jdd�d�|j	|jdd�d�|j	|jdd�d�|j	|jdd�d�|j	|jd
d�d�|j	|jdd�d�|j	|jdd�d�|j	|jdd�d �|j	|jdd�d!�dS("Nisbad screen distance "x"RMRksbad screen distance "y"RNs1x1+0+0RpR
i�RidthighlightthicknessRRi
i����i����i�iie(i����i����(i����i����(i����i(i����i(ii����(ii����(ii(ii(ii(ii(ii(ii(R�R�Rt
grid_locationR"RRRRR$R�R.(RRmRn((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_location&s:	



c	Cs�|j|jj�t�|jt��|jjtt�WdQX|jjt�|j|jj��tj	|jdddddd�}|j
dddd�|jj�|j|j�d�|j|j
�d�|jt�tj	|jdd	dd
dd�}|j
d|dddd�|jj�|j|j�d�|j|j
�d�|jt�|jj�|j|j�d	�|j|j
�d
�dS(
NR
idRRRR�iR�iKiURRG(R$RR�R-R�R�R^R�RRR�R.R�R�(RRntg((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_propagateFs($

$


cCs�|jt��|jjd�WdQX|j|jj�d�tj|j�}|jdddd�|j|jj�d	�|jdddd�|j|jj�d
�dS(NiR�R�iiii(ii(ii(ii(R�R�RR�R$RtScaleR�(RRn((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_size\scCs�|j|jj�g�tj|j�}|jdddd�tj|j�}|jdddd�tj|j�}|jdddd�tj|j�}|jdddd�|j|jj�||||g�|j|jjdd�|g�|j|jjdd�|||g�|j|jjdd�|g�|j|jjdd�|||g�|j|jjdddd�||g�dS(NR�iR�i(R$RR�RtLabelR�(RRRRR((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyttest_grid_slavesfs%"("(N("RcRdReRfR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�(((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyR��s>									
	
							
	
				
	
						 		
t__main__(tunittestRttTkinterRRttest.test_supportRRttest_ttk.supportRRRtwidget_testsRRtTestCaseR	RgR�t	tests_guiRc(((sG/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_geometry_managers.pyt<module>s
����test_tkinter/test_images.pyc000064400000037047150351526620012324 0ustar00�
zfc@s�ddlZddlZddlZddljZddlmZm	Z	ej
d�deejfd��YZdeejfd��YZ
deejfd	��YZee
efZed
kr�eje�ndS(i����N(tAbstractTkTesttrequires_tcltguitMiscTestcBseZd�Zd�ZRS(cCsC|jj�}|j|t�|jd|�|jd|�dS(Ntphototbitmap(troottimage_typestassertIsInstancettupletassertIn(tselfR((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_image_typesscCs#|jj�}|j|t�dS(N(Rtimage_namesRR	(RR
((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_image_namess(t__name__t
__module__RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyR
s	tBitmapImageTestcBsVeZed��Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(cCs,tjj|�tjddd�|_dS(Ns
python.xbmtsubdirt
imghdrdata(Rt
setUpClasst__func__tsupporttfindfilettestfile(tcls((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyRsc
Cs�tjdd|jddddd|j�}|jt|�d�|j|j�d�|j|j�d	�|j|j�d	�|j	d|jj
��~|jd|jj
��dS(
Ns::img::testtmastert
foregroundtyellowt
backgroundtbluetfileRi(ttkintertBitmapImageRRtassertEqualtstrttypetwidththeightR
R
tassertNotIn(Rtimage((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_create_from_filescCs�t|jd��}|j�}WdQXtjdd|jddddd|�}|jt|�d�|j|j�d	�|j|j	�d
�|j|j
�d
�|jd|jj��~|j
d|jj��dS(Ntrbs::img::testRRRRRtdataRi(topenRtreadR R!RR"R#R$R%R&R
R
R'(RtfR+R(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_create_from_data*s	cCs0|j|t�|j|jj|�|�dS(N(RR#R"Rt	splitlist(Rtactualtexpected((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pytassertEqualStrList8scCs�tjdd|j�}|j|dd�t|jd��}|j�}WdQX|jd|�|j|ddddd|f�|j|j	�d�|j|j
�d�|j|d	d
�|jd	|�|j|d	dddd|f�dS(Ns::img::testRR+s-data {} {} {} {}R*s-datatitmaskdatas-maskdata {} {} {} {}s	-maskdata(R R!RR"R,RR-t	configureR3R%R&(RR(R.R+((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_configure_data<s

cCs�tjdd|j�}|j|dd�|jd|j�|j|ddddd|jf�|j|j�d�|j|j�d�|j|dd	�|jd|j�|j|dd
ddd|jf�dS(Ns::img::testRRs-file {} {} {} {}s-fileR4itmaskfiles-maskfile {} {} {} {}s	-maskfile(	R R!RR"R6RR3R%R&(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_configure_fileLs

cCsTtjdd|j�}|j|dd�|jdd�|j|dd�dS(Ns::img::testRRs-background {} {} {} {}Rs-background {} {} {} blue(R R!RR"R6(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_configure_backgroundZscCsTtjdd|j�}|j|dd�|jdd�|j|dd�dS(Ns::img::testRRs!-foreground {} {} #000000 #000000Rs -foreground {} {} #000000 yellow(R R!RR"R6(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_configure_foreground`s

(RRtclassmethodRR)R/R3R7R9R:R;(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyRs						tPhotoImageTestcBseZed��Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
edd�d
��Zedd�d��Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs,tjj|�tjddd�|_dS(Ns
python.gifRR(RRRRRR(R((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyRkscCstjdd|jd|j�S(Ns::img::testRR(R t
PhotoImageRR(R((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pytcreatepscGs-tjdkr|jr|Stj|�SdS(Ng333333!@(R t	TkVersiontwantobjectst_join(Rtargs((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyt	colorlisttscCs�tjd|dd�}tjdd|jd|�}|jt|�d�|j|j�d�|j|j�d�|j|j	�d�|j|d	d
�|j|d|�|j
d|jj��~|jd|jj��dS(Nspython.RRs::img::testRRRiR+R4(
RRR R>RR"R#R$R%R&R
R
R'(RtextRR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pytcheck_create_from_filezs	cCs,tjd|dd�}t|d��}|j�}WdQXtjdd|jd|�}|jt|�d�|j|j	�d�|j|j
�d	�|j|j�d	�|j|d|jr�|n|j
d
��|j|dd�|jd|jj��~|jd|jj��dS(
Nspython.RRR*s::img::testRR+Ritlatin1RR4(RRR,R-R R>RR"R#R$R%R&RAtdecodeR
R
R'(RRERR.R+R(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pytcheck_create_from_data�s	cCs|jd�dS(Ntppm(RF(R((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_create_from_ppm_file�scCs|jd�dS(NRJ(RI(R((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_create_from_ppm_data�scCs|jd�dS(Ntpgm(RF(R((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_create_from_pgm_file�scCs|jd�dS(NRM(RI(R((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_create_from_pgm_data�scCs|jd�dS(Ntgif(RF(R((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_create_from_gif_file�scCs|jd�dS(NRP(RI(R((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_create_from_gif_data�siicCs|jd�dS(Ntpng(RF(R((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_create_from_png_file�scCs|jd�dS(NRS(RI(R((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_create_from_png_data�scCs�tjdd|j�}|j|dd�t|jd��}|j�}WdQX|jd|�|j|d|jr|n|j	d��|j|j
�d�|j|j�d�dS(Ns::img::testRR+R4R*RGi(R R>RR"R,RR-R6RARHR%R&(RR(R.R+((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyR7�scCs�tjdd|j�}|j|dd�|jd|jdd�|j|d|jradnd�|j|j�d�|j|j�d�dS(	Ns::img::testRtformatR4RRPi(RP(	R R>RR"R6RRAR%R&(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_configure_format�scCs�tjdd|j�}|j|dd�|jd|j�|j|d|j�|j|j�d�|j|j�d�dS(Ns::img::testRRR4i(R R>RR"R6RR%R&(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyR9�scCsTtjdd|j�}|j|dd�|jdd�|j|dd�dS(Ns::img::testRtgammas1.0g@s2.0(R R>RR"R6(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_configure_gamma�scCs�tjdd|j�}|j|dd�|j|dd�|jdd�|jdd�|j|dd�|j|dd	�|j|j�d�|j|j�d�dS(
Ns::img::testRR%t0R&ii
t20t10(R R>RR"R6R%R&(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_configure_width_height�scCsxtjdd|j�}|j|dd�|jdd�|j|dd�|jdd�|j|dd�dS(Ns::img::testRtpaletteR4it256s3/4/2(R R>RR"R6(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_configure_palette�scCsq|j�}|j�|j|j�d�|j|j�d�|j|jdd�|jddd��dS(Niiii(R?tblankR"R%R&tgetRD(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyt
test_blank�s

cCsp|j�}|j�}|j|j�d�|j|j�d�|j|jdd�|jdd��dS(Niii(R?tcopyR"R%R&Rb(RR(timage2((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyt	test_copy�s
cCs�|j�}|jdd�}|j|j�d�|j|j�d�|j|jdd�|jdd��|jd�}|j|j�d�|j|j�d�|j|jdd�|jdd��dS(Niiiii(R?t	subsampleR"R%R&Rb(RR(Re((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_subsample�s(cCs)|j�}|jdd�}|j|j�d�|j|j�d�|j|jdd�|jdd��|j|jd	d
�|jdd��|jd�}|j|j�d�|j|j�d�|j|jdd�|jdd��|j|jd	d�|jdd��dS(
Niii i0iiiii	iii
(R?tzoomR"R%R&Rb(RR(Re((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyt	test_zooms(((cCs�|j�}|jddd�|j|jdd�|jddd��|j|jdd�|jdtjdkr}d	ndd��|j|jdd
�|jddd��|j|jdd
�|jddd��|jddf�|j|jdd�|jddd��|j|jdd�|jddd��|j|jdd�|jddd��|j|jdd�|jddd��dS(Ns{red green} {blue yellow}ttoiii�iig333333!@i�is#f00s#00ff00s
#000000fffs
#ffffffff0000i(ii(s#f00s#00ff00(s
#000000fffs
#ffffffff0000(R?tputR"RbRDR R@(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_puts+
+++++cCs|j�}|j|jdd�|jddd��|j|jdd�|jddd��|j|jdd�|jddd��|jtj|jdd�|jtj|jdd�|jtj|jd	d�|jtj|jdd	�dS(
Niii>iti�iii����i(R?R"RbRDtassertRaisesR tTclError(RR(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyttest_get s+++c	Cs�|j�}|jtjtj�|jtj�tjdd|jdddtj�}|j	t
|�d�|j	|j�d�|j	|j�d�|j	|j
�d�|j	|jdd�|jdd��|j	|jd	d
�|jd	d
��|jtjdddd�tjdd|jdddtj�}|j	t
|�d�|j	|j�d�|j	|j�d�|j	|j
�d�|j	|jdd�|jd
d��|j	|jdd�|jdd
��dS(Ns::img::test2RRVRJRRiiiiRPtfrom_coordsiii	s::img::test3iiii(iiii	(R?t
addCleanupRtunlinktTESTFNtwriteR R>RR"R#R$R%R&Rb(RR(Retimage3((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyt
test_write*s,((((RRR<RR?RDRFRIRKRLRNRORQRRRRTRUR7RWR9RYR]R`RcRfRhRjRmRpRw(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyR=is4																							
t__main__(tunittesttTkinterR tttkttest.test_supportttest_supportRttest_ttk.supportRRtrequirestTestCaseRRR=t	tests_guiRtrun_unittest(((s</usr/lib64/python2.7/lib-tk/test/test_tkinter/test_images.pyt<module>s

R�test_tkinter/test_misc.py000064400000010233150351526620011633 0ustar00import unittest
import Tkinter as tkinter
from test.test_support import requires, run_unittest
from test_ttk.support import AbstractTkTest

requires('gui')

class MiscTest(AbstractTkTest, unittest.TestCase):

    def test_after(self):
        root = self.root
        cbcount = {'count': 0}

        def callback(start=0, step=1):
            cbcount['count'] = start + step

        # Without function, sleeps for ms.
        self.assertIsNone(root.after(1))

        # Set up with callback with no args.
        cbcount['count'] = 0
        timer1 = root.after(0, callback)
        self.assertIn(timer1, root.tk.call('after', 'info'))
        (script, _) = root.tk.splitlist(root.tk.call('after', 'info', timer1))
        root.update()  # Process all pending events.
        self.assertEqual(cbcount['count'], 1)
        with self.assertRaises(tkinter.TclError):
            root.tk.call(script)

        # Set up with callback with args.
        cbcount['count'] = 0
        timer1 = root.after(0, callback, 42, 11)
        root.update()  # Process all pending events.
        self.assertEqual(cbcount['count'], 53)

        # Cancel before called.
        timer1 = root.after(1000, callback)
        self.assertIn(timer1, root.tk.call('after', 'info'))
        (script, _) = root.tk.splitlist(root.tk.call('after', 'info', timer1))
        root.after_cancel(timer1)  # Cancel this event.
        self.assertEqual(cbcount['count'], 53)
        with self.assertRaises(tkinter.TclError):
            root.tk.call(script)

    def test_after_idle(self):
        root = self.root
        cbcount = {'count': 0}

        def callback(start=0, step=1):
            cbcount['count'] = start + step

        # Set up with callback with no args.
        cbcount['count'] = 0
        idle1 = root.after_idle(callback)
        self.assertIn(idle1, root.tk.call('after', 'info'))
        (script, _) = root.tk.splitlist(root.tk.call('after', 'info', idle1))
        root.update_idletasks()  # Process all pending events.
        self.assertEqual(cbcount['count'], 1)
        with self.assertRaises(tkinter.TclError):
            root.tk.call(script)

        # Set up with callback with args.
        cbcount['count'] = 0
        idle1 = root.after_idle(callback, 42, 11)
        root.update_idletasks()  # Process all pending events.
        self.assertEqual(cbcount['count'], 53)

        # Cancel before called.
        idle1 = root.after_idle(callback)
        self.assertIn(idle1, root.tk.call('after', 'info'))
        (script, _) = root.tk.splitlist(root.tk.call('after', 'info', idle1))
        root.after_cancel(idle1)  # Cancel this event.
        self.assertEqual(cbcount['count'], 53)
        with self.assertRaises(tkinter.TclError):
            root.tk.call(script)

    def test_after_cancel(self):
        root = self.root
        cbcount = {'count': 0}

        def callback():
            cbcount['count'] += 1

        timer1 = root.after(5000, callback)
        idle1 = root.after_idle(callback)

        # No value for id raises a ValueError.
        with self.assertRaises(ValueError):
            root.after_cancel(None)

        # Cancel timer event.
        cbcount['count'] = 0
        (script, _) = root.tk.splitlist(root.tk.call('after', 'info', timer1))
        root.tk.call(script)
        self.assertEqual(cbcount['count'], 1)
        root.after_cancel(timer1)
        with self.assertRaises(tkinter.TclError):
            root.tk.call(script)
        self.assertEqual(cbcount['count'], 1)
        with self.assertRaises(tkinter.TclError):
            root.tk.call('after', 'info', timer1)

        # Cancel same event - nothing happens.
        root.after_cancel(timer1)

        # Cancel idle event.
        cbcount['count'] = 0
        (script, _) = root.tk.splitlist(root.tk.call('after', 'info', idle1))
        root.tk.call(script)
        self.assertEqual(cbcount['count'], 1)
        root.after_cancel(idle1)
        with self.assertRaises(tkinter.TclError):
            root.tk.call(script)
        self.assertEqual(cbcount['count'], 1)
        with self.assertRaises(tkinter.TclError):
            root.tk.call('after', 'info', idle1)


tests_gui = (MiscTest, )

if __name__ == "__main__":
    run_unittest(*tests_gui)
test_tkinter/test_misc.pyc000064400000007400150351526620012000 0ustar00�
zfc@s�ddlZddlZddlmZmZddlmZed�deejfd��YZ	e	fZ
edkr�ee
�ndS(i����N(trequirestrun_unittest(tAbstractTkTesttguitMiscTestcBs#eZd�Zd�Zd�ZRS(cs�|j}idd6�dd�fd�}|j|jd��d�d<|jd|�}|j||jjdd��|jj|jjdd|��\}}|j�|j�dd�|j	t
j��|jj|�WdQXd�d<|jd|dd�}|j�|j�dd	�|jd
|�}|j||jjdd��|jj|jjdd|��\}}|j|�|j�dd	�|j	t
j��|jj|�WdQXdS(Nitcountics||�d<dS(NR((tstarttstep(tcbcount(s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_misc.pytcallbackstaftertinfoi*ii5i�(
troottassertIsNoneR
tassertInttktcallt	splitlisttupdatetassertEqualtassertRaisesttkintertTclErrortafter_cancel(tselfRR	ttimer1tscriptt_((Rs:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_misc.pyt
test_after
s.	

*


*
cs�|j}idd6�dd�fd�}d�d<|j|�}|j||jjdd��|jj|jjdd|��\}}|j�|j�dd�|jt	j
��|jj|�WdQXd�d<|j|dd�}|j�|j�dd	�|j|�}|j||jjdd��|jj|jjdd|��\}}|j|�|j�dd	�|jt	j
��|jj|�WdQXdS(
NiRics||�d<dS(NR((RR(R(s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_misc.pyR	1sR
Ri*ii5(Rt
after_idleRRRRtupdate_idletasksRRRRR(RRR	tidle1RR((Rs:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_misc.pyttest_after_idle-s,	

*


*
cs|j}idd6��fd�}|jd|�}|j|�}|jt��|jd�WdQXd�d<|jj|jj	dd|��\}}|jj	|�|j
�dd�|j|�|jtj��|jj	|�WdQX|j
�dd�|jtj��|jj	dd|�WdQX|j|�d�d<|jj|jj	dd|��\}}|jj	|�|j
�dd�|j|�|jtj��|jj	|�WdQX|j
�dd�|jtj��|jj	dd|�WdQXdS(NiRcs�dcd7<dS(NRi(((R(s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_misc.pyR	Qsi�R
Ri(
RR
RRt
ValueErrorRtNoneRRRRRR(RRR	RRRR((Rs:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_misc.pyttest_after_cancelMs8	

*


*
(t__name__t
__module__RR R#(((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_misc.pyRs	#	 t__main__(tunittesttTkinterRttest.test_supportRRttest_ttk.supportRtTestCaseRt	tests_guiR$(((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_misc.pyt<module>s
o	test_tkinter/__init__.pyc000064400000000220150351526620011536 0ustar00�
zfc@sdS(N((((s9/usr/lib64/python2.7/lib-tk/test/test_tkinter/__init__.pyt<module>ttest_tkinter/test_text.pyo000064400000003467150351526620012056 0ustar00�
zfc@s�ddlZddlZddlmZmZddlmZed�deejfd��YZ	e	fZ
edkr�ee
�ndS(i����N(trequirestrun_unittest(tAbstractTkTesttguitTextTestcBs#eZd�Zd�Zd�ZRS(cCs,tt|�j�tj|j�|_dS(N(tsuperRtsetUpttkintertTexttrootttext(tself((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_text.pyR
scCs�|j}|j�}zJ|jd�|j|j�d�|jd�|j|j�d�Wd|j|�|j|j�|�XdS(Nii(R
tdebugtassertEqual(RR
tolddebug((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_text.pyt
test_debugs	


cCs�|j}|jtj|jdd�|jtj|jdd�|jtj|jdd�|jtj|jdd�|jdd�|j|jddd�d�|j|jd	dd�d
�dS(Ns1.0tatishi-tests-testtends1.2ttests1.3(R
tassertRaisesRtTclErrortsearchtNonetinsertR
(RR
((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_text.pyttest_searchs	(t__name__t
__module__RRR(((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_text.pyRs		t__main__(tunittesttTkinterRttest.test_supportRRttest_ttk.supportRtTestCaseRt	tests_guiR(((s:/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_text.pyt<module>s
$	test_tkinter/test_widgets.pyc000064400000172022150351526620012516 0ustar00�
zfc@sTddlZddlZddlmZddlZddlZddlmZmZddl	m
Z
mZmZm
Z
ddlmZmZmZmZmZmZmZmZmZmZed�deefd��YZee�d	eejfd
��Y�Zee�deejfd��Y�Zee�d
eejfd��Y�Zdeefd��YZee�deejfd��Y�Zee�deejfd��Y�Z ee�deejfd��Y�Z!ee�deejfd��Y�Z"ee�deejfd��Y�Z#de#ejfd��YZ$eee�deejfd��Y�Z%ee�de%ejfd ��Y�Z&ee�d!eejfd"��Y�Z'eee�d#eejfd$��Y�Z(eee�d%eejfd&��Y�Z)eee�d'eejfd(��Y�Z*eee�d)eejfd*��Y�Z+ee�d+eejfd,��Y�Z,ee�d-eejfd.��Y�Z-eee�d/eejfd0��Y�Z.e e(e!e%eeee)e#e-e.e$e,e"e*e+e&e'egZ/e0d1krPee/�ndS(2i����N(tTclError(trequirestrun_unittest(ttcl_versiontrequires_tcltget_tk_patchlevelt	widget_eq(
tadd_standard_optionstnoconvtnoconv_metht	int_roundtpixels_roundtAbstractWidgetTesttStandardOptionsTeststIntegerSizeTeststPixelSizeTeststsetUpModuletguitAbstractToplevelTestcBs2eZeZd�Zd�Zd�Zd�ZRS(cCso|j�}|j|d|jjj��|j|dddd�|jdd�}|j|dd�dS(NtclasstFooterrmsgs2can't modify -class option after widget is createdtclass_(tcreatetassertEqualt	__class__t__name__ttitletcheckInvalidParam(tselftwidgettwidget2((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_classs
cCsc|j�}|j|dd�|j|dddd�|jdd�}|j|dd�dS(NtcolormapttnewRs5can't modify -colormap option after widget is created(RRR(RRR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_colormapscCs�|j�}|j|d|jr(dnd�|j|dddd�|jdt�}|j|d|jrvdnd�dS(Nt	containerit0iRs6can't modify -container option after widget is createdt1(RRtwantobjectsRtTrue(RRR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_container's#cCsc|j�}|j|dd�|j|dddd�|jdd�}|j|dd�dS(NtvisualR"tdefaultRs3can't modify -visual option after widget is created(RRR(RRR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_visual/s(Rt
__module__R	t_conv_pad_pixelsR R$R*R-(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRs
				tToplevelTestcBs2eZdZd�Zd�Zd�Zd�ZRS(t
backgroundtborderwidthRR!R%tcursortheightthighlightbackgroundthighlightcolorthighlightthicknesstmenutpadxtpadytrelieftscreent	takefocustuseR+twidthcKstj|j|�S(N(ttkintertTopleveltroot(Rtkwargs((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRBscCsN|j�}tj|j�}|j|d|dt�|j|dd�dS(NR8teqR"(RR@tMenuRBt
checkParamR(RRR8((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt	test_menuEscCs�|j�}|j|dd�ytjd}Wntk
rQ|jd�nX|j|d|dd�|jd|�}|j|d|�dS(NR<R"tDISPLAYsNo $DISPLAY set.Rs3can't modify -screen option after widget is created(RRtostenvirontKeyErrortskipTestR(RRtdisplayR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_screenKs
cCsl|j�}|j|dd�|jdt�}d|j�}|jd|�}|j|d|�dS(NR>R"R%s%#x(RRR)twinfo_id(RRtparenttwidR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_useWs(R1R2RR!R%R3R4R5R6R7R8R9R:R;R<R=R>R+R?(RR.tOPTIONSRRGRNRR(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR08s			t	FrameTestcBseZdZd�ZRS(R1R2RR!R%R3R4R5R6R7R9R:R;R=R+R?cKstj|j|�S(N(R@tFrameRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRjs(R1R2RR!R%R3R4R5R6R7R9R:R;R=R+R?(RR.RSR(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRTas
tLabelFrameTestcBs)eZdZd�Zd�Zd�ZRS(R1R2RR!R%R3tfontt
foregroundR4R5R6R7tlabelanchortlabelwidgetR9R:R;R=ttextR+R?cKstj|j|�S(N(R@t
LabelFrameRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRyscCsW|j�}|j|ddddddddd	d
ddd
�|j|dd�dS(NRYtetentestntnetnwtstsetswtwtwntwstcenter(RtcheckEnumParamR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_labelanchor|s
cCsQ|j�}tj|jdddd�}|j|d|dd�|j�dS(NR[tMupptnametfooRZtexpecteds.foo(RR@tLabelRBRFtdestroy(RRtlabel((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_labelwidget�s(R1R2RR!R%R3RWRXR4R5R6R7RYRZR9R:R;R=R[R+R?(RR.RSRRkRs(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRVns		tAbstractLabelTestcBseZeZd�ZRS(c	Cs2|j�}|j|ddddddd�dS(NR7ig�������?g������@ii����t10p(RtcheckPixelsParam(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_highlightthickness�s(RR.R	t_conv_pixelsRw(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRt�st	LabelTestcBseZdZd�ZRS(tactivebackgroundtactiveforegroundtanchorR1tbitmapR2tcompoundR3tdisabledforegroundRWRXR4R5R6R7timagetjustifyR9R:R;tstateR=R[ttextvariablet	underlineR?t
wraplengthcKstj|j|�S(N(R@RpRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�s(RzR{R|R1R}R2R~R3RRWRXR4R5R6R7R�R�R9R:R;R�R=R[R�R�R?R�(RR.RSR(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRy�st
ButtonTestc Bs eZd"Zd �Zd!�ZRS(#RzR{R|R1R}R2tcommandR~R3R,RRWRXR4R5R6R7R�R�t
overreliefR9R:R;trepeatdelaytrepeatintervalR�R=R[R�R�R?R�cKstj|j|�S(N(R@tButtonRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs)|j�}|j|dddd�dS(NR,tactivetdisabledtnormal(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_default�s( RzR{R|R1R}R2R�R~R3R,RRWRXR4R5R6R7R�R�R�R9R:R;R�R�R�R=R[R�R�R?R�(RR.RSRR�(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR��s	tCheckbuttonTestc&Bs)eZd)Zd&�Zd'�Zd(�ZRS(*RzR{R|R1R}R2R�R~R3RRWRXR4R5R6R7R�tindicatoronR�t	offrelieftoffvaluetonvalueR�R9R:R;tselectcolortselectimageR�R=R[R�t
tristateimaget
tristatevalueR�tvariableR?R�cKstj|j|�S(N(R@tCheckbuttonRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs,|j�}|j|ddddd�dS(NR�igffffff@R"s
any string(RtcheckParams(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_offvalue�scCs,|j�}|j|ddddd�dS(NR�igffffff@R"s
any string(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_onvalue�s(&RzR{R|R1R}R2R�R~R3RRWRXR4R5R6R7R�R�R�R�R�R�R�R9R:R;R�R�R�R=R[R�R�R�R�R�R?R�(RR.RSRR�R�(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR��s		tRadiobuttonTestc%Bs eZd'Zd%�Zd&�ZRS((RzR{R|R1R}R2R�R~R3RRWRXR4R5R6R7R�R�R�R�R�R9R:R;R�R�R�R=R[R�R�R�R�tvalueR�R?R�cKstj|j|�S(N(R@tRadiobuttonRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs,|j�}|j|ddddd�dS(NR�igffffff@R"s
any string(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_value�s(%RzR{R|R1R}R2R�R~R3RRWRXR4R5R6R7R�R�R�R�R�R9R:R;R�R�R�R=R[R�R�R�R�R�R�R?R�(RR.RSRR�(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR��s	tMenubuttonTestcBs�eZd(Zee�Zd�Zd�Zd �Ze	j
jZ
ej
ejd!kd"�d#��Zd$�Zd%�Zd&�Zd'�ZRS()RzR{R|R1R}R2R~R3t	directionRRWRXR4R5R6R7R�R�R�R8R9R:R;R�R=R[R�R�R?R�cKstj|j|�S(N(R@t
MenubuttonRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs/|j�}|j|dddddd�dS(NR�tabovetbelowtflushtlefttright(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_direction�scCs/|j�}|j|dddddt�dS(NR4idi����itconv(RtcheckIntegerParamtstr(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_heightstdarwins"crashes with Cocoa Tk (issue19733)c	Cs�|j�}tjd|jdd�}|j|d|dt�d}|jtj��}d|d<WdQX|dk	r�|j	t|j
�|�n|jtj��}|jidd6�WdQX|dk	r�|j	t|j
�|�ndS(NtmasterRmtimage1R�R�simage "spam" doesn't existtspam(RR@t
PhotoImageRBRFR�tassertRaisesRtNoneRt	exceptiont	configure(RRR�Rtcm((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_image	scCsH|j�}tj|dd�}|j|d|dt�|j�dS(NRmR8RD(RR@RERFRRq(RRR8((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRGscCsE|j�}|j|ddddd�|j|dddd�dS(	NR9ig������@gffffff@t12mi����Roi(RRvRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt	test_padxscCsE|j�}|j|ddddd�|j|dddd�dS(	NR:ig������@gffffff@R�i����Roi(RRvRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt	test_pady$scCs/|j�}|j|dddddt�dS(NR?i�in���iR�(RR�R�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_width)s(RzR{R|R1R}R2R~R3R�RRWRXR4R5R6R7R�R�R�R8R9R:R;R�R=R[R�R�R?R�(RR.RStstaticmethodRRxRR�R�R
Rwtim_functunittesttskipIftsystplatformR�RGR�R�R�(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR��s(						tOptionMenuTestcBseZddd�ZRS(tbtatccKstj|jd|||�S(N(R@t
OptionMenuRBR�(RR,tvaluesRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR0s(R�R�R�(RR.R(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�.st	EntryTestcBsheZd)Zd�Zd �Zd!�Zd"�Zd#�Zd$�Zd%�Z	d&�Z
d'�Zd(�ZRS(*R1R2R3tdisabledbackgroundRtexportselectionRWRXR5R6R7tinsertbackgroundtinsertborderwidtht
insertofftimetinsertontimetinsertwidthtinvalidcommandR�treadonlybackgroundR;tselectbackgroundtselectborderwidthtselectforegroundtshowR�R=R�tvalidatetvalidatecommandR?txscrollcommandcKstj|j|�S(N(R@tEntryRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRCscCs |j�}|j|d�dS(NR�(RtcheckColorParam(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_disabledbackgroundFsc	CsQ|jdd�}|j|ddddddd	�|j|dd
dd
�dS(NR�idR�ig�������?g������@ii����Rui<Roii2(RRvRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_insertborderwidthJscCs�|j�}|j|dddd�|j|dddd�|j|dddd�td	�d
kr�|j|dd	dd�n|j|dd	dd�dS(NR�g�������?g������@Rug�������?Roii����g�������?ii(RRvRFR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_insertwidthQscCs0|j�}|j|d�|j|d�dS(NR�tinvcmd(RtcheckCommandParam(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_invalidcommand[scCs |j�}|j|d�dS(NR�(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_readonlybackground`scCsI|j�}|j|dd�|j|dd�|j|dd�dS(NR�t*R"t (RRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt	test_showdscCs)|j�}|j|dddd�dS(NR�R�R�treadonly(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_statejsc	Cs2|j�}|j|ddddddd�dS(NR�talltkeytfocustfocusintfocusouttnone(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_validateoscCs0|j�}|j|d�|j|d�dS(NR�tvcmd(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_validatecommandts(R1R2R3R�RR�RWRXR5R6R7R�R�R�R�R�R�R�R�R;R�R�R�R�R�R=R�R�R�R?R�(
RR.RSRR�R�R�R�R�R�R�R�R�(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�4s(				
					tSpinboxTestc,Bs�eZd9Zd,�Zd:Zd-�Zd.�Zd/�Zd0�Z	d1�Z
d2�Zd3�Zd4�Z
d5�Zd6�Zd7�Zd8�ZRS(;RzR1R2tbuttonbackgroundtbuttoncursortbuttondownrelieftbuttonupreliefR�R3R�RR�RWRXtformattfromR5R6R7t	incrementR�R�R�R�R�R�R�R;R�R�R�R�R�R�R�R=R�ttoR�R�R�R?twrapR�cKstj|j|�S(N(R@tSpinboxRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs |j�}|j|d�dS(NR�(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_buttonbackground�scCs |j�}|j|d�dS(NR�(RtcheckCursorParam(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_buttoncursor�scCs |j�}|j|d�dS(NR�(RtcheckReliefParam(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_buttondownrelief�scCs |j�}|j|d�dS(NR�(RR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_buttonuprelief�scCs�|j�}|j|dd�|j|dd�|j|dd�|j|dd�|j|dd�|j|dd�|j|dd�|j|dd	�|j|dd
�|j|dd�|j|dd�|j|dd
�dS(NR�s%2fs%2.2fs%.2fs%2.fs%2e-1fs2.2s%2.-2fs%-2.02fs% 2.02fs	% -2.200fs%09.200fs%d(RRFR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_format�scCsU|j�}|j|dd�|j|dddd�|j|dddd	�dS(
NR�gY@R�i����gffffff$@gffffff'@i�Rs*-to value must be greater than -from value(RRFtcheckFloatParamR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt	test_from�s
cCs/|j�}|j|dddddd�dS(NR�i����igffffff$@g������)@i(RR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_increment�scCsU|j�}|j|dd�|j|dddd�|j|dddd	�dS(
NR�gY�R�i����gffffff$@gffffff'@i8���Rs*-to value must be greater than -from value(RRFRR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_to�s
cCs||j�}|j|dd�|j|dd�|j|dd
dd�|j|dddd�|j|dd�dS(NR�R"smon tue wed thurtmonttuetwedtthurRoi*g��Q�	@s
any strings42 3.14 {} {any string}(RR	R
R(i*g��Q�	@R"s
any string(RRRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_values�scCs |j�}|j|d�dS(NR�(RtcheckBooleanParam(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt	test_wrap�scCs�|j�}|j|jd��|jtj|jd�|jtj|jd�|jt|j�|jt|jdd�dS(Nitnoindexi(RtassertIsBoundingBoxtbboxR�R@RR�t	TypeError(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt	test_bbox�scCsl|j�}|j|j�d�|jd�|j|j�d�|jd�|j|j�d�dS(NR�tbuttonupt
buttondown(RRtselection_element(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_selection_element�s

(,RzR1R2R�R�R�R�R�R3R�RR�RWRXR�R�R5R6R7R�R�R�R�R�R�R�R�R;R�R�R�R�R�R�R�R=R�R�R�R�R�R?R�R�N(RR.RSRR�R�R�R�RRRRRRRRRR(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�zs8												tTextTestc)Bs1eZd@ZedAkr!eZnd+�Zd,�Zed)d*�d-��Z	ed)d*�d.��Z
d/�Zd0�Zed)d*�d1��Z
ed)d2�d3��Zd4�Zd5�Zd6�Zd7�Zed)d*�d8��Zd9�Zd:�Zed)d*�d;��Zd<�Zd=�Zd>�Zd?�ZRS(BtautoseparatorsR1tblockcursorR2R3tendlineR�RWRXR4R5R6R7tinactiveselectbackgroundR�R�R�R�tinsertunfocussedR�tmaxundoR9R:R;R�R�R�tsetgridtspacing1tspacing2tspacing3t	startlineR�ttabsttabstyleR=tundoR?R�R�tyscrollcommandiicKstj|j|�S(N(R@tTextRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs |j�}|j|d�dS(NR(RR
(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_autoseparators�scCs |j�}|j|d�dS(NR(RR
(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_blockcursor�scCs�|j�}djd�td�D��}|jd|�|j|dddd�|j|dd	dd�|j|dd
dd�|j|dd
�|j|dd�|j|dddd�dS(Ns
css|]}dVqdS(sLine %dN((t.0ti((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pys	<genexpr>sidtendRi�RoR"i����R�Rsexpected integer but got "spam"i2R#ii
s1-startline must be less than or equal to -endline(RtjointrangetinsertRFR(RRR[((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_endlinescCs^|j�}|j|ddddd�|j|dddd�|j|dd	dd�dS(
NR4idg�����LY@gfffff�Y@t3ci����Roii(RRvRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs)|j�}|j|dddd�dS(NRiii����(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_maxundoscCs |j�}|j|d�dS(NR(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_inactiveselectbackgroundsicCs)|j�}|j|dddd�dS(NRthollowR�tsolid(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_insertunfocussedsc
Cs>|j�}|j|ddddddtdtd
k�dS(NR�g�������?g������@i����RuR�t	keep_origii(ii(RRvRR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_selectborderwidth$scCsE|j�}|j|ddddd�|j|dddd�dS(	NR igffffff5@g������6@s0.5ci����Roi(RRvRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_spacing1*scCsE|j�}|j|ddddd�|j|dddd�dS(	NR!ig������@gffffff@s0.1ci����Roi(RRvRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_spacing2/scCsE|j�}|j|ddddd�|j|dddd�dS(	NR"igffffff5@g������6@s0.5ci����Roi(RRvRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_spacing34scCs�|j�}djd�td�D��}|jd|�|j|dddd�|j|dd	dd�|j|dd
dd�|j|dd
�|j|dd�|j|dddd�dS(Ns
css|]}dVqdS(sLine %dN((R+R,((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pys	<genexpr><sidR-R#i�RoR"i����R�Rsexpected integer but got "spam"i
Ri2iFs1-startline must be less than or equal to -endline(RR.R/R0RFR(RRR[((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_startline9scCsK|j�}tdkr1|j|ddd�n|j|ddd�dS(NiiR�R�R�(ii(RRR�Rj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�Gsc
Cs�|j�}t�dkr7|j|ddd	d�n|j|dd�|j|ddd	d�|j|dd
d	d�|j|dddddtdk�dS(NiiiR$gffffff$@g33333�4@t1it2iRos10.2s20.7s10.2 20.7 1i 2is2c left 4c 6c centert2cR�t4ct6cRiR�Rsbad screen distance "spam"R8(iii(gffffff$@g33333�4@R>R?(s10.2s20.7R>R?(gffffff$@g33333�4@R>R?(s10.2s20.7R>R?(R@R�RARBRi(ii(RRRFRR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt	test_tabsNs
cCs&|j�}|j|ddd�dS(NR%ttabulart
wordprocessor(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_tabstyle]scCs |j�}|j|d�dS(NR&(RR
(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt	test_undobscCsU|j�}|j|dd�|j|dddd�|j|dddd�dS(NR?i�in���Roii(RR�RF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�fscCsQ|j�}tdkr4|j|dddd�n|j|dddd�dS(NiiR�tcharR�tword(ii(RRR�Rj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRlscCs�|j�}|j|jd��|j|jd��|jtj|jd�|jtj|jd�|jtj|j�|jtj|jdd�dS(Ns1.1R-R(RRRtassertIsNoneR�R@RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRss()RR1RR2R3RR�RWRXR4R5R6R7RR�R�R�R�RR�RR9R:R;R�R�R�RR R!R"R#R�R$R%R=R&R?R�R�R'(ii(RR.RSRR)t
_stringifyRR)RR*R1R�R3R4R7R9R:R;R<R=R�RCRFRGR�RR(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�sB														t
CanvasTestcBsheZd#Zee�ZeZd�Zd�Z	d�Z
d�Zd�Zd �Z
d!�Zd"�ZRS($R1R2tcloseenoughtconfineR3R4R5R6R7R�R�R�R�R�toffsetR;tscrollregionR�R�R�R�R=R�txscrollincrementR'tyscrollincrementR?cKstj|j|�S(N(R@tCanvasRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�sc	Cs2|j�}|j|ddddddt�dS(NRMig333333@g������@i����R�(RRtfloat(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_closeenough�scCs |j�}|j|d�dS(NRN(RR
(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_confine�scCs�|j�}|j|dd�|j|dddddddd	d
d�|j|dd�|j|dd
�|j|dd�dS(NROs0,0R`RaR]RdRcReRfRbRis10,20s#5,6R�(RRR�RFR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_offset�scCs�|j�}|j|dd�|j|dddd�|j|dd�|j|ddd	d
�|j|dd�|j|dd
�|j|dd�dS(NRPs0 0 200 150ii�i�RoR"R�Rsbad scrollRegion "spam"(iii�i�(iii�R�(iii�(iii�i�i(RRFR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_scrollregion�scCs,|j�}|j|ddddd�dS(NR�R�R�Rs0bad state value "{}": must be normal or disabled(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR��sc	Cs2|j�}|j|ddddddd�dS(NRQi(ig������D@g������E@i���s0.5i(RRv(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_xscrollincrement�sc	Cs2|j�}|j|ddddddd�dS(NRRi
igffffff&@g333333+@i����s0.1i(RRv(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_yscrollincrement�s(R1R2RMRNR3R4R5R6R7R�R�R�R�R�ROR;RPR�R�R�R�R=R�RQR'RRR?(RR.RSR�R
RxR)RKRRURVRWRXR�RYRZ(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRL}s(								tListboxTestcBs�eZd,Zd�Zd�Zeddd�ejj�Zd�Z	d�Z
d �Zd!�Zd"�Z
d#�Zd$�Zd%�Zd&�Zd'�Zd(�Zd)�Zd*�Zd+�ZRS(-tactivestyleR1R2R3RR�RWRXR4R5R6R7R�tlistvariableR;R�R�R�t
selectmodeRR�R=R?R�R'cKstj|j|�S(N(R@tListboxRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs)|j�}|j|dddd�dS(NR\tdotboxR�R�(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_activestyle�siiicCs5|j�}tj|j�}|j|d|�dS(NR](RR@t	DoubleVarRBtcheckVariableParam(RRtvar((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_listvariable�scCs\|j�}|j|dd�|j|dd�|j|dd�|j|dd�dS(NR^tsingletbrowsetmultipletextended(RRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_selectmode�s
cCs&|j�}|j|ddd�dS(NR�R�R�(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR��sc
Cs�|j�}|jtd��|jd�WdQXdj�}|jd|�x-t|�D]\}}|j|d|�q[W|jt��|j�WdQX|jtd��|jd�WdQX|j	|jdd�d�|j	|jdd�d�|j	|jdd�d�|jd�}|j
|t�x�|j�D]s\}}|j
t|�d�t|�d
krD|j	||jd|��|j	|d|jd|��qDqDWdS(Nsitem number "0" out of rangeis)red orange yellow green blue white violetR-R1sbad listbox index "red"tredt
BackgroundR"tviolets@0,0iii(R1R1RlR"Rk(R1R1RlR"Rm(R1R1RlR"Rk(ii(RtassertRaisesRegexpRt
itemconfiguretsplitR0t	enumerateR�RRtassertIsInstancetdicttitemstassertIntlentitemcget(RRtcolorsR,tcolortdtktv((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_itemconfigure�s0c	Cs�|j�}|jddddd�|jdi||6�|j|jd|�d|�|j|jd|�|�|jtd��|jdid	|6�WdQXdS(
NR-R�R�R�Rziisunknown color name "spam"R�(RR0RoRRwRnR(RRmR�R((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pytcheck_itemconfigures cCs|jdd�dS(NR1s#ff0000(R~(R((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_itemconfigure_backgroundscCs|jdd�dS(Ntbgs#ff0000(R~(R((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_itemconfigure_bgscCs|jdd�dS(Ntfgs#110022(R~(R((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_itemconfigure_fgscCs|jdd�dS(NRXs#110022(R~(R((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_itemconfigure_foregroundscCs|jdd�dS(NR�s#110022(R~(R((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt#test_itemconfigure_selectbackgroundscCs|jdd�dS(NR�s#654321(R~(R((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt#test_itemconfigure_selectforegroundscCs�|j�}|jdd�td�D��|j�|j|jd��|j|jd��|j|jd��|jt|jd�|jt|jd�|jt
|j�|jt
|jdd�dS(Nicss|]}d|VqdS(sel%dN((R+R,((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pys	<genexpr>sii����i
Ri(RR0R/tpackRRRJR�RR�R(Rtlb((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_boxs 
cCs�|j�}|jdd�td�D��|jdtj�|jdd�|jd�|j|j�d�|j	t
|jd�dS(	Nicss|]}d|VqdS(sel%dN((R+R,((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pys	<genexpr>+siiiii(iiii(RR0R/tselection_clearR@tENDt
selection_setRtcurselectionR�R(RR�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_curselection)s 
cCs�|j�}|jdd�td�D��|j|jd�d�|j|jd�d�|j|jd�d�|j|jd�d	�|j|jd
�d	�|j|jdd�d�|j|jdd�d�|j|jdd�d�|j|jdd�d�|jt|jd�|jt|jd�|jt|j�|jt|jdd�|jt|jddd�|jt|jd�dS(Nicss|]}d|VqdS(sel%dN((R+R,((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pys	<genexpr>4sitel0itel3R-tel7R"i����itel4tel5tel6Riig333333@(R�R�R�(R�R�R�((R�(	RR0R/RtgetR�RR�R(RR�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_get2s" (R\R1R2R3RR�RWRXR4R5R6R7R�R]R;R�R�R�R^RR�R=R?R�R'(RR.RSRRaRR
ttest_justifyR�ReRjR�R}R~RR�R�R�R�R�R�R�R�(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR[�s2																	t	ScaleTestcBs�eZd+ZdZd�Zd �Zd!�Zd"�Zd#�Zd$�Z	d%�Z
d&�Zd'�Zd(�Z
d)�Zd*�ZRS(,RzR1tbigincrementR2R�R3tdigitsRWRXR�R5R6R7RrtlengthtorientR;R�R�t
resolutiont	showvaluetsliderlengthtsliderreliefR�R=ttickintervalR�ttroughcolorR�R?tverticalcKstj|j|�S(N(R@tScaleRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRSscCs)|j�}|j|dddd�dS(NR�g������(@g������7@i����(RR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_bigincrementVscCs&|j�}|j|ddd�dS(NR�ii(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_digitsZscCs/|j�}|j|dddddt�dS(NR�idg������-@g333333.@R�(RRtround(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR^scCs6|j�}|j|dd�|j|dd�dS(NRrs
any stringR"(RRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_labelbscCs,|j�}|j|ddddd�dS(NR�i�gffffff`@g33333�`@t5i(RRv(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_lengthgscCs,|j�}|j|ddddd�dS(NR�g������@ig������@i����(RR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_resolutionkscCs |j�}|j|d�dS(NR�(RR
(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_showvalueoscCs/|j�}|j|dddddd�dS(NR�i
gffffff&@g333333/@i����t3m(RRv(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_sliderlengthsscCs |j�}|j|d�dS(NR�(RR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_sliderreliefxsc	CsQ|j�}|j|ddddddt�|j|dddd	dt�dS(
NR�ig333333@gffffff@iR�i����Roi(RRR�RF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_tickinterval|s
c	Cs2|j�}|j|ddddddt�dS(NR�i,g������-@g333333.@i����R�(RRR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�s(RzR1R�R2R�R3R�RWRXR�R5R6R7RrR�R�R;R�R�R�R�R�R�R�R=R�R�R�R�R?(RR.RStdefault_orientRR�R�RR�R�R�R�R�R�R�R(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�Fs(											t
ScrollbarTestcBs\eZdZee�ZeZdZd�Z	d�Z
d�Zd�Zd�Z
d�ZRS(RztactivereliefR1R2R�R3telementborderwidthR5R6R7tjumpR�R;R�R�R=R�R?R�cKstj|j|�S(N(R@t	ScrollbarRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs |j�}|j|d�dS(NR�(RR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_activerelief�scCs,|j�}|j|ddddd�dS(NR�g333333@gffffff@i����t1m(RRv(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_elementborderwidth�scCs,|j�}|j|ddddd�dS(NR�R�t
horizontalRs4bad orientation "{}": must be vertical or horizontal(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_orient�scCsg|j�}xdD]}|j|�qW|jd�|jt|j�|jt|jdd�dS(Ntarrow1tslidertarrow2R"(R�R�R�(RtactivateR�R(RtsbR]((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_activate�s

cCs�|j�}|jdd�|j|j�d�|jt|jdd�|jt|jdd�|jt|jdd�|jt|jd�|jt|jddd�dS(	Ng�������?g�������?tabctdefg333333�?gffffff�?g�������?(g�������?g�������?(RtsetRR�R�RR�(RR�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_set�s(RzR�R1R2R�R3R�R5R6R7R�R�R;R�R�R=R�R?(RR.RSR�R
RxR)RKR�RR�R�R�R�R�(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR��s 					tPanedWindowTestcBsgeZd2ZdZd�Zd�Zd�Zd�Zd�Ze	ddd�d��Z
e	ddd�d��Ze	ddd�d��Zd�Z
d�Zd �Zd!�Zd"�Zd#�Zd$�Zd%�Zed&�Zd'�Zd(�Zd)�Zd*�Ze	dd�d+��Zd,�Zd-�Zd.�Zd/�Ze	dd�d0��Z d1�Z!RS(3R1R2R3t	handlepadt
handlesizeR4topaqueresizeR�tproxybackgroundtproxyborderwidthtproxyreliefR;t
sashcursortsashpadt
sashrelieft	sashwidtht
showhandleR?R�cKstj|j|�S(N(R@tPanedWindowRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs/|j�}|j|dddddd�dS(NR�ig������@gffffff@i����R�(RRv(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_handlepad�sc
Cs5|j�}|j|dddddddt�dS(NR�ig������"@g333333%@i����t2mR�(RRvR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_handlesize�scCs8|j�}|j|ddddddddt�dS(	NR4idg�����LY@gfffff�Y@i����iR>R�(RRvR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR��s!cCs |j�}|j|d�dS(NR�(RR
(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_opaqueresize�siiicCs |j�}|j|d�dS(NR�(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_proxybackground�scCs8|j�}|j|ddddddddt�dS(	NR�ig�������?g333333@ii����RuR�(RRvR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_proxyborderwidth�scCs |j�}|j|d�dS(NR�(RR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_proxyrelief�scCs |j�}|j|d�dS(NR�(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_sashcursor�scCs/|j�}|j|dddddd�dS(NR�ig�������?g������@i����R�(RRv(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_sashpad�scCs |j�}|j|d�dS(NR�(RR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_sashrelief�sc
Cs5|j�}|j|dddddddt�dS(NR�i
g333333&@g333333/@i����R�R�(RRvR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_sashwidth�scCs |j�}|j|d�dS(NR�(RR
(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_showhandle�scCs8|j�}|j|ddddddddt�dS(	NR?i�gfffff6y@g�����Iy@in���iR�R�(RRvR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�s!cCsQ|j�}tj|�}tj|�}|j|�|j|�|||fS(N(RR@R�tadd(RtpR�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pytcreate2s

cCs�|j�\}}}|jt|j�|j|�}|j|t�xl|j�D]^\}}|jt|�d�|j||j||��|j|d|j	||��qTWdS(Nii(
R�R�Rt
paneconfigureRrRsRtRRvtpanecget(RR�R�R�RzR{R|((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigurescCs�d�}|js|r(t|�}n|jr@|r@t}n|j|i||6�|j||j||�d�|�|j||j||��|�dS(NcSs|S(N((tx((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt<lambda>R"i(R(R�R�RR�(RR�R�RmR�Rot	stringifyR�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pytcheck_paneconfigures		&c	Cs4|jt|��|j|id|6�WdQXdS(NtbadValue(RnRR�(RR�R�Rmtmsg((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pytcheck_paneconfigure_bad$scCsN|j�\}}}|j||d|t|��|j||dd�dS(Ntaftersbad window path name "badValue"(R�R�R�R�(RR�R�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigure_after(scCsN|j�\}}}|j||d|t|��|j||dd�dS(Ntbeforesbad window path name "badValue"(R�R�R�R�(RR�R�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigure_before.scCsW|j�\}}}|j||ddddt�dk�|j||dd�dS(	NR4i
R�iiisbad screen distance "badValue"(iii(R�R�RR�(RR�R�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigure_height4s
cCsH|j�\}}}|j||dtd�|j||dd�dS(Nthideis)expected boolean value but got "badValue"(R�R�tFalseR�(RR�R�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigure_hide;scCsH|j�\}}}|j||ddd�|j||dd�dS(Ntminsizei
sbad screen distance "badValue"(R�R�R�(RR�R�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigure_minsizeBscCsH|j�\}}}|j||ddd�|j||dd�dS(NR9g�������?isbad screen distance "badValue"(R�R�R�(RR�R�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigure_padxHscCsH|j�\}}}|j||ddd�|j||dd�dS(NR:g�������?isbad screen distance "badValue"(R�R�R�(RR�R�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigure_padyNscCsH|j�\}}}|j||ddd�|j||dd�dS(Ntstickytnsewtnesws[bad stickyness value "badValue": must be a string containing zero or more of n, e, s, and w(R�R�R�(RR�R�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigure_stickyTscCsH|j�\}}}|j||ddd�|j||dd�dS(NtstretchtalwtalwayssEbad stretch "badValue": must be always, first, last, middle, or never(R�R�R�(RR�R�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigure_stretch\scCsW|j�\}}}|j||ddddt�dk�|j||dd�dS(	NR?i
R�iiisbad screen distance "badValue"(iii(R�R�RR�(RR�R�R�((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_paneconfigure_widthds
(R1R2R3R�R�R4R�R�R�R�R�R;R�R�R�R�R�R?("RR.RSR�RR�R�R�R�RR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR��sH													

								tMenuTestcBseeZdZeZd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
RS(RztactiveborderwidthR{R1R2R3RRWRXtpostcommandR;R�R=ttearoffttearoffcommandRttypecKstj|j|�S(N(R@RERB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRwscCs |j�}|j|d�dS(NR(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_postcommandzscCs |j�}|j|d�dS(NR(RR
(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_tearoff~scCs |j�}|j|d�dS(NR(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_tearoffcommand�scCs#|j�}|j|dd�dS(NRs
any string(RRF(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt
test_title�scCs)|j�}|j|dddd�dS(NRR�Rtmenubar(RRj(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt	test_type�scCs	|j�}|jdd�|jt|j�|jtd��|jd�WdQX|jd�}|j|t�x�|j	�D]v\}}|j|t
�|j|t�|jt
|�d�|j|d|�|j|jd|�|d�q�W|j�dS(	NRrttestsbad menu entry index "foo"Rniiii(Rtadd_commandR�RtentryconfigureRnRRrRsRtR�ttupleRRvt	entrycgetRq(Rtm1RzR{R|((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_entryconfigure�s$cCsk|j�}|jdd�|j|jdd�d�|jddd�|j|jdd�d�dS(NRrR
itchanged(RRRRR(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_entryconfigure_label�s
c	Cs�|j�}tj|j�}tj|j�}|jd|dtdtdd�|jt|j	dd��t|��|j
dd|�|jt|j	dd��t|��dS(NR�R�R�RrtNonsensei(RR@t
BooleanVarRBtadd_checkbuttonR)R�RR�RR(RRtv1tv2((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_entryconfigure_variable�s((RzRR{R1R2R3RRWRXRR;R�R=RRRR(RR.RSR	RxRRRR	R
RRRR(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyRls								tMessageTestcBs&eZdZeZd�Zd�ZRS(R|taspectR1R2R3RWRXR5R6R7R�R9R:R;R=R[R�R?cKstj|j|�S(N(R@tMessageRB(RRC((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�scCs)|j�}|j|dddd�dS(NRi�ii���(RR�(RR((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyttest_aspect�s(R|RR1R2R3RWRXR5R6R7R�R9R:R;R=R[R�R?(RR.RSR	R/RR(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyR�s	t__main__(1R�tTkinterR@RRIR�ttest.test_supportRRttest_ttk.supportRRRRtwidget_testsRRR	R
RRR
RRRRtTestCaseR0RTRVRtRyR�R�R�R�R�R�R�RRLR[R�R�R�RRt	tests_guiR(((s=/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_widgets.pyt<module>sl"F
%(	AEh�B�B1�D