Skip to content

AsImmutable() does not propagate the return_str_if_not_expected param #16

@tigarmo

Description

@tigarmo

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',) 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions