@@ 106-117 (lines=12) @@ | ||
103 | assert "{test_aspectlib_debug.MyStuff foo='bar' bar='foo'}.stuff()\n{test_aspectlib_debug.MyStuff foo='bar' bar='foo'}.stuff => bar\n" == buf.getvalue() |
|
104 | ||
105 | ||
106 | def test_attributes_old_style(): |
|
107 | buf = StringIO() |
|
108 | with aspectlib.weave(OldStuff, aspectlib.debug.log( |
|
109 | print_to=buf, |
|
110 | stacktrace=10, |
|
111 | attributes=('foo', 'bar()') |
|
112 | ), methods='(?!bar)(?!__.*__$)'): |
|
113 | OldStuff('bar').stuff() |
|
114 | print(repr(buf.getvalue())) |
|
115 | assert re.match(r"^\{test_aspectlib_debug.OldStuff foo='bar' bar='foo'\}.stuff\(\) +<<< .*tests/test_aspectlib_debug.py:\d+:test_attributes.*\n\{test_aspectlib_debug.OldStuff foo='bar' bar='foo'\}.stuff => bar\n$", buf.getvalue()) |
|
116 | MyStuff('bar').stuff() |
|
117 | assert re.match(r"^\{test_aspectlib_debug.OldStuff foo='bar' bar='foo'\}.stuff\(\) +<<< .*tests/test_aspectlib_debug.py:\d+:test_attributes.*\n\{test_aspectlib_debug.OldStuff foo='bar' bar='foo'\}.stuff => bar\n$", buf.getvalue()) |
|
118 | ||
119 | ||
120 | def test_no_stack_old_style(): |
|
@@ 80-91 (lines=12) @@ | ||
77 | assert re.match(r'foo\(\) +<<<.*\nfoo => None\n', buf.getvalue()) |
|
78 | ||
79 | ||
80 | def test_attributes(): |
|
81 | buf = StringIO() |
|
82 | with aspectlib.weave(MyStuff, aspectlib.debug.log( |
|
83 | print_to=buf, |
|
84 | stacktrace=10, |
|
85 | attributes=('foo', 'bar()') |
|
86 | ), methods='(?!bar)(?!__.*__$)'): |
|
87 | MyStuff('bar').stuff() |
|
88 | print(buf.getvalue()) |
|
89 | assert re.match(r"^\{test_aspectlib_debug.MyStuff foo='bar' bar='foo'\}.stuff\(\) +<<< .*tests/test_aspectlib_debug.py:\d+:test_attributes.*\n\{test_aspectlib_debug.MyStuff foo='bar' bar='foo'\}.stuff => bar\n$", buf.getvalue()) |
|
90 | MyStuff('bar').stuff() |
|
91 | assert re.match(r"^\{test_aspectlib_debug.MyStuff foo='bar' bar='foo'\}.stuff\(\) +<<< .*tests/test_aspectlib_debug.py:\d+:test_attributes.*\n\{test_aspectlib_debug.MyStuff foo='bar' bar='foo'\}.stuff => bar\n$", buf.getvalue()) |
|
92 | ||
93 | ||
94 | def test_no_stack(): |