File tree Expand file tree Collapse file tree 4 files changed +84
-0
lines changed
Expand file tree Collapse file tree 4 files changed +84
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Integration Test
2+
3+ on :
4+ pull_request:
5+ branches: [TODO]
6+
7+ jobs :
8+ do_test:
9+ runs-on: ubuntu-latest
10+ steps:
11+ - uses: actions/checkout@v3
12+ - name: Set up Python v3.10
13+ uses: actions/setup-python@v3
14+ with :
15+ python-version: '3.10'
16+ - name: Test!
17+ run: python test.py
Original file line number Diff line number Diff line change @@ -158,3 +158,5 @@ cython_debug/
158158# and can be added to the global gitignore or merged into this file. For a more nuclear
159159# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160160# .idea/
161+
162+ * ~ *
Original file line number Diff line number Diff line change 1+ class ArithmeticPair :
2+ """
3+ Arithmetic operations on a given pair of numbers
4+
5+ Args:
6+ x:
7+ The first operand.
8+ y:
9+ The second operand.
10+ """
11+
12+ def __init__ (self , x , y ):
13+ self .x = x
14+ self .y = y
15+
16+ def sum (self ):
17+ """
18+ Compute :math:`x + y`.
19+ """
20+ #return self.x + self.y
21+
22+ def difference (self ):
23+ """
24+ Compute :math:`x - y`.
25+ """
26+ #return self.y - self.x
27+
28+ def product (self ):
29+ """
30+ Compute :math:`x * y`.
31+ """
32+ #return self.x * self.y
33+
34+ def quotient (self ):
35+ """
36+ Compute :math:`x / y`.
37+ """
38+ #return self.x / self.y
39+
Original file line number Diff line number Diff line change 1+ import unittest
2+ from example import ArithmeticPair as AP
3+
4+ class TestArithmetic (unittest .TestCase ):
5+ def test_sum (self ):
6+ ap = AP (15 , 3 )
7+ ret = ap .sum ()
8+ self .assertEqual (ret , 18 , f"error in sum" )
9+
10+ def test_difference (self ):
11+ ap = AP (15 , 3 )
12+ ret = ap .difference ()
13+ self .assertEqual (ret , 12 , f"error in difference" )
14+
15+ def test_product (self ):
16+ ap = AP (15 , 3 )
17+ ret = ap .product ()
18+ self .assertEqual (ret , 45 , f"error in product" )
19+
20+ def test_quotient (self ):
21+ ap = AP (15 , 3 )
22+ ret = ap .quotient ()
23+ self .assertEqual (ret , 5.0 , f"error in quotient" )
24+
25+ if __name__ == "__main__" :
26+ unittest .main ()
You can’t perform that action at this time.
0 commit comments