cmc-csci046 icon indicating copy to clipboard operation
cmc-csci046 copied to clipboard

Error in AVLTree repo

Open mikeizbicki opened this issue 2 years ago • 3 comments

I've just updated the AVLTree repo to fix an error in the test cases. In particular, the github actions was still configured to test on python 3.6, which is no longer supported by github. (We had this problem on the first assignment, and I thought I had fixed it for all the assignments since then, but I guess I forgot this one.)

You can fix this problem by re-running the

$ git pull upstream avltree

command to get the latest version of the repo. Or if you haven't run this command yet, then when you run it for the first time it will automatically get this change.

mikeizbicki avatar Mar 24 '23 19:03 mikeizbicki

I think there is a syntax error with the new update. On line 286 of the tests/test_BST.py file, there is the <<<<<<< HEAD conflict message and it's interrupting testing

yomnashousha avatar Mar 25 '23 01:03 yomnashousha

I think the test_BST.py eq test also has a problem in that it is not really solvable.

@given(xs=ints)
def test__BST_eq(xs):
    '''
    This test is essentially the same as the previous one,
    but tests the == operator specifically.
    '''
    assert bst1 == bst2

This is the code in the most recent commit of the AVL Branch, and it doesn't define bst1 or bst2 at all, meaning it isn't really possible to pass this test case. I attempted to create a better test case and create a pull request, however, realized that my pull request would include the BST.py code I had written from the previous homework in it and wasn't able to figure out how to properly avoid that. I effectively used the code in the bst__iterable__2 test for this code below.

@given(xs=ints)
def test__BST_eq(xs):
    '''
    This test is essentially the same as the previous one,
    but tests the == operator specifically.
    '''
    xs = list(set(xs))
    xs1 = copy.copy(xs)
    random.shuffle(xs1)
    bst1 = BST(xs1)

    xs2 = copy.copy(xs)
    random.shuffle(xs2)
    bst2 = BST(xs2)

    assert bst1 == bst2

irajmoradi avatar Mar 25 '23 21:03 irajmoradi

@yomnashousha and @irajmoradi: You're both correct. The mistakes you've highlighted have been fixed, and I've awarded you both +1 point in sakai for the correction and fix.

The root cause of these problems is that I encountered a merge conflict at some point and resolved it incorrectly.

Everyone who is running into this same problem should run the command

$ git pull upstream avltree

to redownload the latest version of the test cases.

mikeizbicki avatar Mar 26 '23 04:03 mikeizbicki