Skip to content

AsImmutable() does not propagate the return_str_if_not_expected param #16

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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