예제 #1
0
    def test_numeric(self):
        assert OperatorImpl.truth(True) is True
        assert OperatorImpl.truth(False) is False
        assert OperatorImpl.truth(1) is True
        assert OperatorImpl.truth('') is False

        assert OperatorImpl.equality(1, '1') is True
        assert OperatorImpl.equality(1, '2') is False
        assert OperatorImpl.equality(1, '') is False
        assert OperatorImpl.equality(0, '') is False
        assert OperatorImpl.equality(1, 'abc') is False
        assert OperatorImpl.equality(False, '') is True

        assert OperatorImpl.inequality(1, '1') is False
        assert OperatorImpl.inequality(False, '') is False

        assert OperatorImpl.larger(4, '') is False

        assert OperatorImpl.smaller(800, '1K') is True
        assert OperatorImpl.smaller(1200, '1K') is False
        assert OperatorImpl.smaller(800, '1k') is True
예제 #2
0
 def test_string(self):
     assert OperatorImpl.equality('foo', 'foo') is True
     assert OperatorImpl.equality('foo', '*o') is True