PR: Use zip_longest for handling test data comparison

Could you elaborate on what you mean? Provide an example?

This code passes test but mustn’t

def new_aliens_collection(positions: list[tuple[int, int]]) -> list[Alien]:
    return []

To save folks some time, it seems this is for the Ellen’s Alien Game exercise at python/exercises/concept/ellens-alien-game at main Ā· exercism/python Ā· GitHub. The test for task 7 starts at python/exercises/concept/ellens-alien-game/classes_test.py at 62ac923ed48dfa11e7aa0479f6a5a4e39987b9d4 Ā· exercism/python Ā· GitHub.

The simplest approach might be to assert the lengths of test_data and actual_result are the same before the existing assertions are checked. That should be pretty clear on what’s being checked for students who may not know what zip_longest does.

2 Likes

Oh, thanks, @BNAndras! It’s strange that the system copied the contents of the PR but lost the link. I’ve added the PR link to the starting post. So I’ve missed the fact the context is lost.

Hi @cblp,

Thanks for brining up the issue.

I can take a look a little later in the week (using the context @BNAndras supplied), but the Python track isn’t accepting this sort of change from community contributors right now. Small typos and text correction is fine - but anything that needs investigating, testing, or changes to code/tests is off the table. Sorry.

1 Like

Thank you @BethanyG. It’s a small bugfix, I hope it will find its way.

1 Like

You may want to read,

1 Like