Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions app/test_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,12 @@ def test_divide():
assert Calculator.divide(0, 2.0) == 0
assert Calculator.divide(-4, 2.0) == -2.0
# assert Calculator.divide(2.0, 0.0) == 'Cannot divide by 0'

def test_divide2():
assert Calculator.divide2(1, 2) == 0.5
assert Calculator.divide2(1.0, 2.0) == 0.5
assert Calculator.divide2(0, 2.0) == 0
assert Calculator.divide2(-4, 2.0) == -2.0
assert Calculator.divide2(10, 5) == 2.0
assert Calculator.divide2(-10, -5) == 2.0
assert Calculator.divide2(2.0, 0.0) == 'Cannot divide by 0'
Comment on lines +32 to +40
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test function test_divide2() references Calculator.divide2(), but this method does not exist in the Calculator class (see app/calculator.py). The test will fail with an AttributeError. The divide2() method must be implemented in the Calculator class before this test can pass. According to the repository context, this method should handle division by zero by returning the string 'Cannot divide by 0'.

Did we get this right? 👍 / 👎 to inform future reviews.

Comment on lines +32 to +40
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test function test_divide2() is testing a method Calculator.divide2() that does not exist in the Calculator class (checked in app/calculator.py). This test will fail with an AttributeError when executed. You need to either: (1) implement the divide2() method in the Calculator class, or (2) remove this test if the functionality is not needed. Based on the context, it appears divide2() should be a copy or variant of the existing divide() method.

Did we get this right? 👍 / 👎 to inform future reviews.