mirror of
https://github.com/cool-RR/PySnooper.git
synced 2026-07-19 01:13:50 +00:00
Add test_lambda
This commit is contained in:
parent
619c4406cd
commit
bb6f5133d0
1 changed files with 17 additions and 0 deletions
|
|
@ -233,3 +233,20 @@ def test_confusing_decorator_lines():
|
|||
ReturnEntry(),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def test_lambda():
|
||||
string_io = io.StringIO()
|
||||
my_function = pysnooper.snoop(string_io)(lambda x: x ** 2)
|
||||
result = my_function(7)
|
||||
assert result == 49
|
||||
output = string_io.getvalue()
|
||||
assert_output(
|
||||
output,
|
||||
(
|
||||
VariableEntry('x', '7'),
|
||||
CallEntry(source_regex='^my_function = pysnooper.*'),
|
||||
LineEntry(source_regex='^my_function = pysnooper.*'),
|
||||
ReturnEntry(source_regex='^my_function = pysnooper.*'),
|
||||
)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue