-
Notifications
You must be signed in to change notification settings - Fork 0
Add Tests for PR#4 #5
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
base: lindsayrpiper-patch-3
Are you sure you want to change the base?
Conversation
|
@sentry-seer review |
|
@sentry review |
|
On it! We are reviewing the PR and will provide feedback shortly. |
PR DescriptionThis pull request refactors the testing approach for the Click to see moreKey Technical ChangesThe key technical changes include: 1) Replacing the single Architecture DecisionsThe architectural decision was to adopt the standard Dependencies and InteractionsThis change only affects the Risk ConsiderationsThe primary risk is that the new tests might reveal previously undetected bugs in the Notable Implementation DetailsThe implementation details to note are the use of descriptive test method names (e.g., |
| def test_smile(self): | ||
| """Test that smile function returns the correct emoticon""" | ||
| self.assertEqual(smiles.smile(), ":)") | ||
|
|
||
| def test_smile(): | ||
| assert Smiles.smile() == ":)" | ||
| def test_laugh(self): | ||
| """Test that laugh function returns the correct emoticon""" | ||
| self.assertEqual(smiles.laugh(), ":D") | ||
|
|
||
| def test_cry(self): | ||
| """Test that cry function returns the correct emoticon""" | ||
| self.assertEqual(smiles.cry(), ":'(") | ||
|
|
||
| def test_tongue(self): | ||
| """Test that tongue function returns the correct emoticon""" | ||
| self.assertEqual(smiles.tongue(), ":P") | ||
|
|
||
| def test_glasses(self): | ||
| """Test that glasses function returns the correct emoticon""" | ||
| self.assertEqual(smiles.glasses(), "8)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider grouping related test methods and adding setUp/tearDown methods if needed for test isolation. Also, consider adding edge case tests or error condition tests to make the test suite more robust.
| def test_smile(self): | |
| """Test that smile function returns the correct emoticon""" | |
| self.assertEqual(smiles.smile(), ":)") | |
| def test_smile(): | |
| assert Smiles.smile() == ":)" | |
| def test_laugh(self): | |
| """Test that laugh function returns the correct emoticon""" | |
| self.assertEqual(smiles.laugh(), ":D") | |
| def test_cry(self): | |
| """Test that cry function returns the correct emoticon""" | |
| self.assertEqual(smiles.cry(), ":'(") | |
| def test_tongue(self): | |
| """Test that tongue function returns the correct emoticon""" | |
| self.assertEqual(smiles.tongue(), ":P") | |
| def test_glasses(self): | |
| """Test that glasses function returns the correct emoticon""" | |
| self.assertEqual(smiles.glasses(), "8)") | |
| def setUp(self): | |
| """Set up test fixtures before each test method.""" | |
| pass | |
| def test_smile(self): | |
| """Test that smile function returns the correct emoticon""" | |
| result = smiles.smile() | |
| self.assertIsInstance(result, str) | |
| self.assertEqual(result, ":)") |
|
|
||
| def test_smile(): | ||
| assert Smiles.smile() == ":)" | ||
| def test_laugh(self): | ||
| """Test that laugh function returns the correct emoticon""" | ||
| self.assertEqual(smiles.laugh(), ":D") | ||
|
|
||
| def test_cry(self): | ||
| """Test that cry function returns the correct emoticon""" | ||
| self.assertEqual(smiles.cry(), ":'(") | ||
|
|
||
| def test_tongue(self): | ||
| """Test that tongue function returns the correct emoticon""" | ||
| self.assertEqual(smiles.tongue(), ":P") | ||
|
|
||
| def test_glasses(self): | ||
| """Test that glasses function returns the correct emoticon""" | ||
| self.assertEqual(smiles.glasses(), "8)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test methods are well-structured, but consider adding negative test cases or boundary conditions. For instance, test what happens if the functions are called with unexpected parameters (if they accept any).
| def test_smile(): | |
| assert Smiles.smile() == ":)" | |
| def test_laugh(self): | |
| """Test that laugh function returns the correct emoticon""" | |
| self.assertEqual(smiles.laugh(), ":D") | |
| def test_cry(self): | |
| """Test that cry function returns the correct emoticon""" | |
| self.assertEqual(smiles.cry(), ":'(") | |
| def test_tongue(self): | |
| """Test that tongue function returns the correct emoticon""" | |
| self.assertEqual(smiles.tongue(), ":P") | |
| def test_glasses(self): | |
| """Test that glasses function returns the correct emoticon""" | |
| self.assertEqual(smiles.glasses(), "8)") | |
| def test_all_functions_return_strings(self): | |
| """Test that all emoticon functions return string types""" | |
| functions = [smiles.smile, smiles.laugh, smiles.cry, smiles.tongue, smiles.glasses] | |
| for func in functions: | |
| with self.subTest(func=func.__name__): | |
| result = func() | |
| self.assertIsInstance(result, str) | |
| self.assertTrue(len(result) > 0) |
This PR adds tests for #4
Commits: