Пример #1
0
class Float(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([])
    test_integer = lambda self: self.assert_no_match(0)

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

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

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

    # Assertion functions

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

    def assert_no_match(self, value):
        return super(Float, self).assert_no_match(__unit__.Float(), value)
Пример #2
0
 def assert_no_match(self, value):
     return super(Float, self).assert_no_match(__unit__.Float(), value)