Calling AsImmutable()
on a sequence/container does not propagate the return_str_if_not_expected
boolean parameter to the recursive calls of the function. That is, the second pytest.raises
here fails (and the assertion passes):
def test_return_str_if_not_expected_recursive():
from oop_ext.foundation.immutable import AsImmutable
import numpy as np
with pytest.raises(RuntimeError):
AsImmutable(np.int32(5), return_str_if_not_expected=False)
with pytest.raises(RuntimeError):
assert AsImmutable([np.int32(5)], return_str_if_not_expected=False) == ('5',)