I’ve mentored a few students on their Mecha Munch Management solutions, and some of them had implemented task#5 (Send User Shopping Cart to Store for Fulfillment) in a way that have a bug but pass the tests.
On send_to_store function we are told: “The function should return a combined “fulfillment cart” that has (quantity, aisle, and refrigeration) for each item the customer is ordering”. Function’s arguments are: customer’scart & store’saisle_mapping.
Some students solutions looped over aisle_mapping and not over cart. If there is an item in aisle_mapping thats not in cart , we’ll get a KeyError exception or item be in the returned fulfillment dictionary. In the real app we’ll expect store’saisle_mapping to have information about all of store’s items, so this is a likely scenario.
I suggest adding the case to check the above. Here is a commit on forked repository to be used for PR if you approve.
This was an initiative of @snovalnikov, the last student I’ve mentored on this exercise. He wanted to open this discussion, but probably too busy at this time.
Apologies for the long delay in getting back to you. Yes! – please go ahead and make a PR to the content repo for these test changes. – and thank you for proposing them. Two favors to ask as you do that:
Maybe add one more additional test case so that students clearly get the picture. One case might look like a “mistake”, but failing two will strongly nudge the student to (maybe?) check their methodology.
We recently updated the spelling of aisle (vs isle - which is an error ) for this exercise, please make sure that those changes are picked up in any fork/branch you’re PR-ing from.
The PR will close – but I will reopen and review/merge.
I’ve tried to follow your requests., hopefully all in successful manner. Please tell me if any changes are needed.
It seem there where redundant empty line (# 34) and space (# 133), so I’ve removed them as well.
Indentation of closing brackets were changed automatically by my editor - hope this is acceptable. Shouldn’t a formatter, like Black, be applied as part of CI?
It’s not, really – for some reason, I didn’t notice it when reviewing, but went back and fixed it just now.
We use Black for our practice exercise formatting, but I have found Black quite problematic for concept exercises.
This is partly due to us formatting the test files in a particular way to be more readable/maintainable - and partly due to Black’s unfortunate handling of nested data structures (it makes an utter mess of them, the more nested, the bigger the mess).
While we can (now that they’ve finally introduced a skip) insert skips, I’d rather not have to clutter the files with skip notes or worry about having to reformat something like this or this when Black mucks it up.
This might change in the future, but because we’d need to test things out, it’s not likely to change any time soon.