Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For those stuck on the first unit tests (Spoilers) #5

Open
AppleBottomSneed opened this issue Jun 7, 2024 · 1 comment
Open

For those stuck on the first unit tests (Spoilers) #5

AppleBottomSneed opened this issue Jun 7, 2024 · 1 comment

Comments

@AppleBottomSneed
Copy link

Remember to check the errors the unit tests throw at you and have a thorough look on why it is.

In this case, under test_car_park.py:

def test_car_park_initialized_with_all_attributes(self):
    self.assertIsInstance(self.car_park, CarPark)
    self.assertEqual(self.car_park.location, "123 Example Street")
    self.assertEqual(self.car_park.capacity, 100)
    self.assertEqual(self.car_park.plates, [])
    self.assertEqual(self.car_park.sensors, [])
    self.assertEqual(self.car_park.displays, [])
    self.assertEqual(self.car_park.available_bays, 100)

I overlooked it and forgot to properly instance the lists as they're mutable and should never be set as the default by itself i.e. plates, sensors and displays. Hope this helps

@rafrafavi
Copy link
Contributor

@AppleBottomSneed - I know it was a while ago, but I am just going through and making fixes - can you recall what the action steps were here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants