File: //usr/lib/python3/dist-packages/hamcrest/core/core/__pycache__/isinstanceof.cpython-38.pyc
U
�b�VH � @ sH d dl mZ d dlmZ dZdZdZd dlZG dd� de�Zd d
� Z dS )� )�BaseMatcher)�is_matchable_typezJon ReidzCopyright 2011 hamcrest.orgzBSD, see License.txtNc @ s$ e Zd Zdd� Zdd� Zdd� ZdS )�IsInstanceOfc C s t |�std��|| _d S )Nz:IsInstanceOf requires type or a tuple of classes and types)r � TypeError�
expected_type)�selfr � r �A/usr/lib/python3/dist-packages/hamcrest/core/core/isinstanceof.py�__init__ s zIsInstanceOf.__init__c C s t || j�S �N)�
isinstancer )r �itemr r r �_matches s zIsInstanceOf._matchesc C sP z| j j}W n. tk
r: dd�dd� | j D �� }Y nX |�d��|� d S )Nz one of %s�,c s s | ]}t |�V qd S r )�str)�.0�er r r � <genexpr> s z+IsInstanceOf.describe_to.<locals>.<genexpr>zan instance of )r �__name__�AttributeError�joinZappend_text)r ZdescriptionZtype_descriptionr r r �describe_to s
�zIsInstanceOf.describe_toN)r �
__module__�__qualname__r
r r r r r r r
s r c C s t | �S )ad Matches if object is an instance of, or inherits from, a given type.
:param atype: The type to compare against as the expected type or a tuple
of types.
This matcher checks whether the evaluated object is an instance of
``atype`` or an instance of any class that inherits from ``atype``.
Example::
instance_of(str)
)r )Zatyper r r �instance_of s r )
Zhamcrest.core.base_matcherr Z"hamcrest.core.helpers.wrap_matcherr �
__author__Z
__copyright__Z__license__�typesr r r r r r �<module> s