Sam's Surf Shop - Why won't my test_add_surfboards test work? (in tests.py)

It returns
x.

ERROR: test_add_surfboards (main.Tests) [3]

Traceback (most recent call last):
File “tests.py”, line 18, in test_add_surfboards
self.assertEqual(self.Cart.add_surfboards(num), f’Successfully added {num} surfboard{s} to cart!’)
File “/home/ccuser/workspace/sams-surf-shop/surfshop.py”, line 17, in add_surfboards
raise TooManyBoardsError
surfshop.TooManyBoardsError

======================================================================
ERROR: test_add_surfboards (main.Tests) [4]

Traceback (most recent call last):
File “tests.py”, line 18, in test_add_surfboards
self.assertEqual(self.Cart.add_surfboards(num), f’Successfully added {num} surfboard{s} to cart!’)
File “/home/ccuser/workspace/sams-surf-shop/surfshop.py”, line 17, in add_surfboards
raise TooManyBoardsError
surfshop.TooManyBoardsError


Ran 3 tests in 0.000s

FAILED (errors=2, expected failures=1)

I think this covers the issue you’re seeing-

You’re adding more boards each time without resetting or making a new object.

1 Like