diff --git a/tests/test_pysnooper.py b/tests/test_pysnooper.py index 8c0a0e1..4ba26c4 100644 --- a/tests/test_pysnooper.py +++ b/tests/test_pysnooper.py @@ -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.*'), + ) + )