Assignment C1_W2 Exercise 4

I am getting the correct outcome for Exercise 4, but the “test your solution” is returning an error.

(Moderation Edit - solution code removed)

But I am getting the following test error

AttributeError                            Traceback (most recent call last)
~/work/w2_unittest.py in test_augmented_to_ref(target)
    346         try:
--> 347             assert result.shape == test_case["expected"]["A_ref"].shape
    348             successful_cases += 1

AttributeError: 'NoneType' object has no attribute 'shape'

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
<ipython-input-71-041849f721e5> in <module>
      1 # Test your solution
----> 2 w2_unittest.test_augmented_to_ref(augmented_to_ref)

~/work/w2_unittest.py in test_augmented_to_ref(target)
    352                     "name": test_case["name"],
    353                     "expected": test_case["expected"]["A_ref"].shape,
--> 354                     "got": result.shape,
    355                 }
    356             )

AttributeError: 'NoneType' object has no attribute 'shape'

Hi @Ian_G_Smith!

First, I would like to welcome to our community! It is always good to have new learners here!

Second, I would kindly ask you to not share solution codes in your posts because this goes agains our community guidelines - our purpose here is to help learners achieve their own results and not provide a complete solution for them, so having solution codes in topics may impact other learners solutions! Therefore, I have removed your solution code, but I left the error you are mentioning.

Regarding the error, it seems that you have forgotten to return the matrix in some of the functions used in augmented_to_ref, this is why the error is “NoneType” object has no attribute ‘shape’.

Try going back and looking at your code to find one function that has no return!

If you still have issues or doubts, please let me know.

Regards,
Lucas