Despite passing all unit tests for Exercises 1 thru 3, I was failing Exercise 4 unit test. Debugging revealed I had an issue with my conditions in Exercise 1. I noticed another post for C1_M1 that was also failing Exercise 4 despite passing all previous unit tests. Turns out the individual discovered they did not correctly complete Exercise 2 even though their code passed the unit test, and the unit test required an update. Thought I’d create a post in case an update the Exercise 1 unit test is deemed necessary.
did you pass the grader @tybenz25
I have completed this assignmen, what did the grader submission provide detail about exercise 1 on why it failed ??
Also in order to understand whether a new test is required, it would be helpful to know what the mistake was you made in your version of Exercise 1. Can you describe that in words without showing the code? If it requires showing code, then we can do that on a DM thread.
Yes, I had an incorrect value in one of the conditional variable assignments, which threw off one value in the output. This resulted in Exercise 4 having an expected value below the tolerance in the training results.
Hi Deepti - I didn’t submit the assignment until I figured out the bug that was causing Exercise 4 unit tests to fail. Please see my response to paulinpaloalto.
can you DM anyone of us your exercise 1 code? and also can I ask why do you feel issue is only with exercise 1 in particular, because inspite passing all unittest, there could be conflict between variable recall as one could pass all the unittest and still autograder sometimes gives a failed submission.
Probably share a screenshot of the failed exercise 4 unit test here which will give hint were your codes might be going wrong.
hi @tybenz25
- first issue with your code in exercise 1.
is evening rush limits are greater or equal to 16.0 and not 6.0. HERE ARE THE INSTRUCTIONS ![]()
- next in the exercise 2, looks like your all_values codes were changed which wasn’t supposed to be especially because it was outside the markers ###START AND END CODE HERE###
COMPARE with my grade function screenshot (without codes),![]()
Notice there is no torch.asarray to df.values but your codes has this. I suggest get a fresh copy and re-do just in case there weren’t any other changes.
Regards
DP
Thanks, Deepti - I made the updates, which fixed everything, and my assignment passed with 100%. I was just curious if your Exercise 1 unit test passed if you change 16.0 to 6.0 for the is_evening_rush variable.
no changing to another numerical fails the test, but I am more thinking in your case it might be when you passed the test you probably wrote 16.0 and eventually 1 must have got erased by mistake, also pointing to the all_values changes.
autograders and unittest are surely a bonkers sometime
but I understand we are human and we aren’t perfect, and so are the unittest ![]()
![]()
and at the end these makes me more better at debugging and coding and more attentive while writing codes.
Copy that. It was a good debugging exercise for me, and I’m glad I was able to get everything to pass. It’s a great course, and I appreciate the support!
happy to help @tybenz25
keep learning!!!
Yes, if I make that code error, then I get the behavior you described:
The unit test for Exercise 1 passes, but the the unit test for Exercise 4 fails.
So I think we need to file a bug here that the test cases for Exercise 1 need to be beefed up.
I then submitted to the grader with that bug in Exercise 1 and the grader does the right thing:
I get 0 points for Exercise 1 and full points for the other three, including Exercise 4.
oh for me it unittest failed
for exercise 1 when I used incorrect numerical
please check this topic, exercise 1 seems to be passing unittest even with incorrect numerical values
Regards
DP
Actually there is enough information in the output for Exercise 1 to realize that something is wrong:
But the unit tests need to fail. Of course thinking just a bit more, the memories come flooding back. Writing thorough test cases is hard work: you have to come up with test cases for all the boundaries there. SQA takes serious work. Sigh …
even @tybenz25 had different output for exercise 1 which he did point out when he sent me codes, but surely this is a bug when clearly instructions mentions something, unittest should catch up.
Sure, it would be easy to add a test to catch that one particular error. But if we’re going to “go there”, the right thing would be to add explicit test cases for all of the 4 boundaries there and to think about the weekday flag as well. So not just an easy one line addition …
sorry @tybenz25
I just checked again, even for me the unittest passes. thank you for reporting this. I checked the unittest.py file which clearly doesn’t specify the value specificity of rush_hour_features but does point in the is_the_rush hour for exercise 2.
Exercise 1 unittest is only specified to check for function type error and not value specific error and probably that’s why the exercise 1 unit test is not catching the numerical error. This is surely a big, thanks @paulinpaloalto for checking up too, for me first time I actually changed the value and & which unittest catched it.
Regards
DP
Oh, cool! I have run into similar issues as a developer, so I can definitely appreciate the task of writing unit tests. Glad this post will help!


