You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This requires that Allergies(255).list return items in exactly the same order as they are written above. If the order is not important, assertItemsEqual() is better. Unfortunately, in Python 3 this was renamed to assertCountEqual(), which does not exist in Python 2.7. So perhaps assertEqual(sorted(expected), sorted(actual)) would in fact be the best solution here.
Alternatively, if the requirement for identical ordering is intentional, it should be made clearer using assertSequenceEqual(). At present, the README merely states that it should return "All the allergens Tom is allergic to."
I believe this may also affect other Python exercises.
I am happy to submit a pull request for said changes, but would first like to know if there is any consensus on exactly what the correct behaviour should be: to require identical ordering or not?
The text was updated successfully, but these errors were encountered:
Order isn't important in the result, though the order does in a way give a hint it is related to binary. Feel free to do a pull request, because I think it would be better to not force order.
We can handle the change between Python 2 and 3 without too much of an issue. Using a library like six would make it easier, but it would probably be difficult to make people install it.
I think we would could do something along the lines of:
This requires that
Allergies(255).list
return items in exactly the same order as they are written above. If the order is not important,assertItemsEqual()
is better. Unfortunately, in Python 3 this was renamed toassertCountEqual()
, which does not exist in Python 2.7. So perhapsassertEqual(sorted(expected), sorted(actual))
would in fact be the best solution here.Alternatively, if the requirement for identical ordering is intentional, it should be made clearer using
assertSequenceEqual()
. At present, the README merely states that it should return "All the allergens Tom is allergic to."I believe this may also affect other Python exercises.
I am happy to submit a pull request for said changes, but would first like to know if there is any consensus on exactly what the correct behaviour should be: to require identical ordering or not?
The text was updated successfully, but these errors were encountered: