The following code defines two classes, MockedA and MockedB, and uses the mock.patch decorator from the unittest.mock module to patch a function with a lambda function that returns the integer value 3. Then RustPython crashes with an assertion error.
test.py
import unittest
from unittest import mock
class MockedA(BaseFTests):
pass
@mock.patch("", lambda: 3)
class MockedB(MockedA):
def _asserts(self, val):
pass
Crash message:
thread 'main' panicked at 'assertion failed: table.sub_tables.is_empty()', compiler/codegen/src/compile.rs:308:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Environment:
Ubuntu 18.04
rustpython v0.2.0
The following code defines two classes, MockedA and MockedB, and uses the mock.patch decorator from the unittest.mock module to patch a function with a lambda function that returns the integer value 3. Then RustPython crashes with an assertion error.
test.py
Crash message:
Environment:
Ubuntu 18.04
rustpython v0.2.0