pydatastructs icon indicating copy to clipboard operation
pydatastructs copied to clipboard

CI Failure for `select()` in `test_select_rank()`. Works locally.

Open Kishan-Ved opened this issue 1 year ago • 0 comments

Description of the problem

In the file: pydatastructs/trees/tests/test_binary_trees.py, inside the _test_AVLTree() function, there is a function called test_select_rank(). This contains a code snippet (that tests the select() method) which is run only when the backend is Python. This is because if we run them in C++ backend, some CI checks fail. However, the code passes when run on my local machine (laptop - Ubuntu). This is the test_select_rank() function:

    def test_select_rank(expected_output):
        if backend==Backend.PYTHON:
            output = []
            for i in range(len(expected_output)):
                output.append(a5.select(i + 1).key)
            assert output == expected_output
        output = []
        expected_ranks = [i + 1 for i in range(len(expected_output))]
        for i in range(len(expected_output)):
            output.append(a5.rank(expected_output[i]))
        assert output == expected_ranks

Notice the snippet that runs only when the backend is PYTHON:

        if backend==Backend.PYTHON:
            output = []
            for i in range(len(expected_output)):
                output.append(a5.select(i + 1).key)
            assert output == expected_output

This was added in the PR: https://github.com/codezonediitj/pydatastructs/pull/564

Kishan-Ved avatar Jul 07 '24 19:07 Kishan-Ved