C2_W1 Assignment problem w/ Exercise 4


All of my tests passed except for exercise 4, even though the code is right and it prints. I’ve already rebooted and updated my notebook following the instructions on the M4ML Resources. Even though I did that, it keeps giving me this error message when I try to test it. How can I solve this?

TypeError Traceback (most recent call last)
Cell In [61], line 1
----> 1 w1_unittest.test_dLdOmega_of_omega_array(dLdOmega_of_omega_array)

File ~/work/w1_unittest.py:342, in test_dLdOmega_of_omega_array(target_dLdOmega_of_omega_array)
318 test_cases = [
319 {
320 “name”: “default_check”,
338 },
339 ]
341 for test_case in test_cases:
→ 342 result = target_dLdOmega_of_omega_array(
343 test_case[“input”][“omega_array”],
344 test_case[“input”][“pA”],
345 test_case[“input”][“pB”])
347 try:
348 assert result.shape == test_case[“expected”][“shape”]

TypeError: dLdOmega_of_omega_array() takes 1 positional argument but 3 were given

1 Like

Dear @Ruba_Muqri,

Can you please send me your notebook as personal message. I’ll into the issues and let you know the problem and their solution.

1 Like

How can I send you the notebook? Should I send the Lab ID or the download link?

This error probably means you are using an obsolete copy of the notebook file or the w1_unittest.py file.

I recommend you update both to the current version. You’ll need to re-enter your code in the notebook.

Instructions for getting the current files can be found here:

I did that multiple times. I was given the same error for exercises 2, 3, and 4 but after updating the notebook, I now only have errors in exercise 4.

Now you know where to focus your attention.

What error messages do you see? (please post screen capture images)

I think you did not get the updated version of the w1_unittest.py file.

I’ll update the file and try it.

You need to delete your current copy (using the Files menu) and then use “get latest version”.

Click on my name then click on message, attach the complete lab files and send to me.

I tried it and still have the same issue. What else can I do?

I recommend you follow @Girijesh instructions.

1 Like

Okay, thank you.

1 Like

Dear @Ruba_Muqri,

Hope your problem has been solved.