Source code for expects.matchers.built_in.be_a

# -*- coding: utf-8 -*

from .. import Matcher


class _BeAnInstanceOf(Matcher):
    def __init__(self, expected):
        self._expected = expected

    def _match(self, subject):
        return isinstance(subject, self._expected), []

    def __repr__(self):
        return '{name} {expected}'.format(name=self._name,
                                          expected=self._expected.__name__)


class be_a(_BeAnInstanceOf):
    pass


class be_an(_BeAnInstanceOf):
    pass


[docs] class a(_BeAnInstanceOf): pass
[docs] class an(_BeAnInstanceOf): pass