2
     ˆËŽþD@¬Ü¤’¸Æ ùÒ705ÑÊÆÎ Á    /* Boost interval/compare.hpp template implementation file
 *
 * Copyright 2002 HervÃ© BrÃ¶nnimann, Guillaume Melquiond, Sylvain Pion
 *
 * Distributed under the Boost Software License, Version 1.0.
 * (See accompanying file LICENSE_1_0.txt or
 * copy at http://www.boost.org/LICENSE_1_0.txt)
 */

#ifndef BOOST_NUMERIC_INTERVAL_COMPARE_HPP
#define BOOST_NUMERIC_INTERVAL_COMPARE_HPP

#include <boost/numeric/interval/compare/certain.hpp>
#include <boost/numeric/interval/compare/possible.hpp>
#include <boost/numeric/interval/compare/explicit.hpp>
#include <boost/numeric/interval/compare/lexicographic.hpp>
#include <boost/numeric/interval/compare/set.hpp>

#endif // BOOST_NUMERIC_INTERVAL_COMPARE_HPP
  8   ˆl–ß=¿Jå5*�vãm\dJbÑ¿�þB «7DGœeÖœ ?ŸÓ„qç/ÒÀÇÏ ?÷     """passlib.tests.test_handlers - tests for passlib hash algorithms"""
#=============================================================================
# imports
#=============================================================================
from __future__ import with_statement
# core
import logging; log = logging.getLogger(__name__)
import os
import sys
import warnings
# site
# pkg
from passlib import exc, hash
from passlib.utils import repeat_string
from passlib.utils.compat import irange, PY3, u, get_method_function
from passlib.tests.utils import TestCase, HandlerCase, skipUnless, \
        TEST_MODE, UserHandlerMixin, EncodingHandlerMixin
# module

#=============================================================================
# constants & support
#=============================================================================

# some common unicode passwords which used as test cases
UPASS_WAV = u('\u0399\u03c9\u03b1\u03bd\u03bd\u03b7\u03c2')
UPASS_USD = u("\u20AC\u00A5$")
UPASS_TABLE = u("t\u00e1\u0411\u2113\u0259")

PASS_TABLE_UTF8 = b't\xc3\xa1\xd0\x91\xe2\x84\x93\xc9\x99' # utf-8

# handlers which support multiple backends, but don't have multi-backend tests.
_omitted_backend_tests = ["django_bcrypt", "django_bcrypt_sha256", "django_argon2"]

#: modules where get_handler_case() should search for test cases.
_handler_test_modules = [
    "test_handlers",
    "test_handlers_argon2",
    "test_handlers_bcrypt",
    "test_handlers_cisco",
    "test_handlers_django",
    "test_handlers_pbkdf2",
    "test_handlers_scrypt",
]

def get_handler_case(scheme):
    """
    return HandlerCase instance for scheme, used by other tests.

    :param scheme: name of hasher to locate test for (e.g. "bcrypt")

    :raises KeyError:
        if scheme isn't known hasher.

    :raises MissingBackendError:
        if hasher doesn't have any available backends.

    :returns:
        HandlerCase subclass (which derives from TestCase)
    """
    from passlib.registry import get_crypt_handler
    handler = get_crypt_handler(scheme)
    if hasattr(handler, "backends") and scheme not in _omitted_backend_tests:
        # XXX: if no backends available, could proceed to pick first backend for test lookup;
        #      should investigate if that would be useful to callers.
        try:
            backend = handler.get_backend()
        except exc.MissingBackendError:
            assert scheme in conditionally_available_hashes
            raise
        name = "%s_%s_test" % (scheme, backend)
    else:
        name = "%s_test" % scheme
    for module in _handler_test_modules:
        modname = "passlib.tests." + module
        __import__(modname)
        mod = sys.modules[modname]
        try:
            return getattr(mod, name)
        except AttributeError:
            pass
    # every hasher should have test suite, so if we get here, means test is either missing,
    # misnamed, or _handler_test_modules list is out of date.
    raise RuntimeError("can't find test case named %r for %r" % (name, scheme))

#: hashes which there may not be a backend available for,
#: and get_handler_case() may (correctly) throw a MissingBackendError
conditionally_available_hashes = ["argon2", "bcrypt", "bcrypt_sha256"]

#=============================