예제 #1
0
def test_lazy_missing():
    lazycall = LazyCall(("doesnt", "exist", "attribute"), ("argument",), {"key": "value"}, False)

    exist = AttrDict()
    doesnt = AttrDict(exist=exist)
    obj = AttrDict(doesnt=doesnt)
    try:
        lazycall.resolve(obj)
    except AttributeError as e:
        assert "doesnt.exist" in e.message
        assert "attribute" in e.message
        assert "key" in e.message
        assert "value" in e.message
        assert "argument" in e.message
        assert repr(obj) in e.message
    else:
        should_never_run()
예제 #2
0
def test_not_really_complex():
    sentinel = object()
    lazycall = LazyCall((), (sentinel,), {}, True, False)

    def sentinel_func():
        should_never_run()

    def target(func):
        assert func is sentinel

    try:
        lazycall.resolve(target, sentinel_func)
    except exceptions.ExceptionInCallError as e:
        assert "sentinel_func" in e.message
        assert "target" in e.message
        assert "NoneType" in e.message
    else:
        should_never_run()
예제 #3
0
def test_exception_in_call():
    lazycall = LazyCall(("herp", "derp"), ("positional_arg",), {"keyword": "kwarg"}, False)

    class SentinelException(Exception):
        pass

    def target(positional_arg, keyword):
        assert positional_arg == "positional_arg"
        assert keyword == "kwarg"
        raise SentinelException()

    herp = AttrDict(derp=target)
    obj = AttrDict(herp=herp)
    try:
        lazycall.resolve(obj)
    except exceptions.ExceptionInCallError as e:
        assert "SentinelException" in e.message
        assert "target" in e.message
        assert "herp.derp" in e.message
    else:
        should_never_run()
예제 #4
0
 def my_conflict(event):
     should_never_run()
예제 #5
0
 def my_command(event):
     should_never_run()
예제 #6
0
 def handler2(event):
     should_never_run()
예제 #7
0
 def derp(event):
     should_never_run()
예제 #8
0
 def my_conflict(event):
     should_never_run()
예제 #9
0
 def my_command(event):
     should_never_run()
예제 #10
0
파일: test_main.py 프로젝트: lahwran/crow2
 def firstmainloop(event):
     should_never_run()
예제 #11
0
 def derp(event):
     should_never_run()
예제 #12
0
from crow2.test.util import should_never_run; should_never_run()
예제 #13
0
 def sentinel_func():
     should_never_run()
예제 #14
0
파일: test_main.py 프로젝트: lahwran/crow2
 def secondmainloop(event):
     should_never_run()
예제 #15
0
파일: test_main.py 프로젝트: lahwran/crow2
 def firstmainloop(event):
     should_never_run()
예제 #16
0
 def handler2(event):
     should_never_run()
예제 #17
0
파일: test_main.py 프로젝트: lahwran/crow2
 def secondmainloop(event):
     should_never_run()
예제 #18
0
from crow2.test.util import should_never_run
should_never_run()