Doing Sams Surfshop (https://www.codecademy.com/courses/learn-intermediate-python-3/projects/int-python-sams-surf-shop) and I am stuck on step 8. When I test the code, it is 2 errors instead of 1. I know where to look for the problem going by the errors but I am not sure how to fix them. Did I miss a step? Any advice would be appreciated thank you.
here is my code:
import unittest
import surfshop
class tests(unittest.TestCase):
def setUp(self):
self.cart = surfshop.ShoppingCart()
def test_add1_surfboards(self):
message = self.cart.add.surfboards(1)
self.assertEqual(message, 'Successfully added 1 surfboard to cart!')
def test_add2_surfboards(self):
message = self.cart.add.surfboards(2)
self.assertEqual(message, 'Successfully added 2 surfboards to cart!')
def test_cart_limits(self):
self.assertRaises(surfshop.TooManyBoardsError, self.cart.add_surfboards, 5)
@unittest.expectedFailure
def test_local_discounts(self):
self.local_discounts
self.assertTrue(cart.apply_locals_discount, cart.locals_discount())
unittest.main()
now here is the error:
EE.x
======================================================================
ERROR: test_add1_surfboards (__main__.tests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tests.py", line 12, in test_add1_surfboards
message = self.cart.add.surfboards(1)
AttributeError: 'ShoppingCart' object has no attribute 'add'
======================================================================
ERROR: test_add2_surfboards (__main__.tests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tests.py", line 17, in test_add2_surfboards
message = self.cart.add.surfboards(2)
AttributeError: 'ShoppingCart' object has no attribute 'add'
----------------------------------------------------------------------
Ran 4 tests in 0.001s
FAILED (errors=2, expected failures=1)