Skip to content

Commit 7b860c3

Browse files
authored
Refactor test_add.py to simplify tests
Removed unittest framework and added basic arithmetic tests.
1 parent 9c332e2 commit 7b860c3

1 file changed

Lines changed: 7 additions & 20 deletions

File tree

test_add.py

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,12 @@
1+
#writing test python code for testing conda yml
2+
def test_addition():
3+
assert 1 + 1 == 2
14

2-
# sum of numbers
3-
import unittest
4-
def addition(a,b):
5-
return a+b
5+
def test_subtraction():
6+
assert 5 - 3 == 2
67

7-
8-
print(addition(2,3)) # Expected output:
9-
# sum of numbers
10-
def addition(a, b):
11-
"""Return the sum of a and b."""
12-
return a + b
13-
14-
class TestAddition(unittest.TestCase):
15-
def test_basic(self):
16-
self.assertEqual(addition(2, 3), 5)
17-
self.assertEqual(addition(-1, 1), 0)
18-
self.assertEqual(addition(0, 0), 0)
19-
20-
if __name__ == "__main__":
21-
# Run the tests
22-
unittest.main()
8+
def test_multiplication():
9+
assert 5 * 2 == 10
2310

2411

2512

0 commit comments

Comments
 (0)