Exemple #1
0
 def test_nice_long_exception_message(self):
     val = str('a' * 500)
     with pytest.raises(AttributeError) as exc:
         Q.upper().foo.eval_(val)
     assert exc.value.args[0] == (
         "'str' object has no attribute 'foo'"
         "\n\n\tEncountered when evaluating <str instance>.foo")
Exemple #2
0
 def test_nice_long_exception_message(self):
     val = str('a' * 500)
     with pytest.raises(AttributeError) as exc:
         Q.upper().foo.eval_(val)
     assert exc.value.args[0] == (
         "'str' object has no attribute 'foo'"
         "\n\n\tEncountered when evaluating <str instance>.foo"
     )
Exemple #3
0
    def test_debug_method(self):
        with pytest.raises(AttributeError):
            Q.upper().foo.eval_('test')

        dbg = Q.debug_()
        assert isinstance(dbg, QDebug)
        assert repr(dbg.expr) == 'Q.upper().foo'
        assert repr(dbg.inner_expr) == '.foo'
        assert dbg.val == 'test'
        assert dbg.inner_val == 'TEST'
Exemple #4
0
    def test_debug_method(self):
        with pytest.raises(AttributeError):
            Q.upper().foo.eval_('test')

        dbg = Q.debug_()
        assert isinstance(dbg, QDebug)
        assert repr(dbg.expr) == 'Q.upper().foo'
        assert repr(dbg.inner_expr) == '.foo'
        assert dbg.val == 'test'
        assert dbg.inner_val == 'TEST'