Esempio n. 1
0
class Long(MatcherTestCase):
    test_none = lambda self: self.assert_no_match(None)
    test_object = lambda self: self.assert_no_match(object())
    test_iterable = lambda self: self.assert_no_match([])

    @skipIf(IS_PY3, "requires Python 2.x")
    def test_integer__py2(self):
        self.assert_no_match(0)

    @skipUnless(IS_PY3, "requires Python 3.x")
    def test_integer__py3(self):
        self.assert_match(0)

    @skipIf(IS_PY3, "requires Python 2.x")
    def test_long(self):
        self.assert_match(eval('0l'))

    test_fraction = lambda self: self.assert_no_match(Fraction(9, 11))
    test_float = lambda self: self.assert_no_match(0.0)
    test_complex = lambda self: self.assert_no_match(complex(0, 1))

    test_repr = lambda self: self.assert_repr(__unit__.Long())

    # Assertion functions

    def assert_match(self, value):
        return super(Long, self).assert_match(__unit__.Long(), value)

    def assert_no_match(self, value):
        return super(Long, self).assert_no_match(__unit__.Long(), value)
Esempio n. 2
0
 def assert_no_match(self, value):
     return super(Long, self).assert_no_match(__unit__.Long(), value)