File tree Expand file tree Collapse file tree 4 files changed +120
-23
lines changed Expand file tree Collapse file tree 4 files changed +120
-23
lines changed Original file line number Diff line number Diff line change 1
- name : test
1
+ name : test
2
2
3
3
on :
4
4
push :
7
7
8
8
jobs :
9
9
test :
10
- runs-on : ubuntu-latest
10
+ runs-on : ubuntu-latest
11
11
12
12
steps :
13
13
- name : Check out repo code
23
23
python -m pip install -r requirements.txt
24
24
- name : Run tests
25
25
run : |
26
- python -m pytest calculator.py
26
+ python -m pytest tests
Original file line number Diff line number Diff line change
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__ /
3
+ * .py [cod ]
4
+
5
+ # C extensions
6
+ * .so
7
+
8
+ # Distribution / packaging
9
+ .Python
10
+ env /
11
+ build /
12
+ develop-eggs /
13
+ dist /
14
+ downloads /
15
+ eggs /
16
+ .eggs /
17
+ lib /
18
+ lib64 /
19
+ parts /
20
+ sdist /
21
+ var /
22
+ * .egg-info /
23
+ .installed.cfg
24
+ * .egg
25
+
26
+ # PyInstaller
27
+ # Usually these files are written by a python script from a template
28
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
29
+ * .manifest
30
+ * .spec
31
+
32
+ # Installer logs
33
+ pip-log.txt
34
+ pip-delete-this-directory.txt
35
+
36
+ # Unit test / coverage reports
37
+ htmlcov /
38
+ .tox /
39
+ .coverage
40
+ .coverage. *
41
+ .cache
42
+ nosetests.xml
43
+ coverage.xml
44
+ * .cover
45
+
46
+ # Translations
47
+ * .mo
48
+ * .pot
49
+
50
+ # Django stuff:
51
+ * .log
52
+
53
+ # Sphinx documentation
54
+ docs /_build /
55
+
56
+ # PyBuilder
57
+ target /
58
+
59
+ # DotEnv configuration
60
+ .env
61
+
62
+ # Database
63
+ * .db
64
+ * .rdb
65
+
66
+ # Pycharm
67
+ .idea
68
+
69
+ # VS Code
70
+ .vscode /
71
+
72
+ # Spyder
73
+ .spyproject /
74
+
75
+ # Jupyter NB Checkpoints
76
+ .ipynb_checkpoints /
77
+
78
+
79
+ # Mac OS-specific storage files
80
+ .DS_Store
81
+
82
+ # vim
83
+ * .swp
84
+ * .swo
85
+
86
+ # Mypy cache
87
+ .mypy_cache /
88
+
Original file line number Diff line number Diff line change 1
1
# Demo Calculator App For Week 1 Project
2
2
# Addition Method
3
3
def add (a , b ):
4
- return (a + b )
4
+ return a + b
5
+
5
6
6
7
# Subtract Method
7
8
def sub (a , b ):
8
- return (a - b )
9
+ return a - b
10
+
9
11
10
12
# Multiplication
11
13
def mul (a , b ):
12
- return (a * b )
13
-
14
- # Division
15
- def div (a ,b ):
16
- return (a / b )
17
-
18
- def test_add ():
19
- assert add (1 ,1 ) == 2
14
+ return a * b
20
15
21
- def test_sub ():
22
- assert sub (1 ,1 ) == 0
23
16
24
- def test_mul ():
25
- assert mul (1 ,1 ) == 1
17
+ # Division
18
+ def div (a , b ):
19
+ return a / b
26
20
27
- def test_div ():
28
- assert div (2 ,1 ) == 2
29
21
30
22
if __name__ == "__main__" :
31
23
# Declare variable and set default values
32
24
a = 4
33
25
b = 2
34
- print (' Sum of ' + str (a ) + ' and ' + str (b ) + ' is ' , add (a , b ))
35
- print (' Difference of ' + str (a ) + ' and ' + str (b ) + ' is ' , sub (a , b ))
36
- print (' Product of ' + str (a ) + ' and ' + str (b ) + ' is ' , mul (a , b ))
37
- print (' Division of ' + str (a ) + ' and ' + str (b ) + ' is ' , div (a , b ))
26
+ print (" Sum of " + str (a ) + " and " + str (b ) + " is " , add (a , b ))
27
+ print (" Difference of " + str (a ) + " and " + str (b ) + " is " , sub (a , b ))
28
+ print (" Product of " + str (a ) + " and " + str (b ) + " is " , mul (a , b ))
29
+ print (" Division of " + str (a ) + " and " + str (b ) + " is " , div (a , b ))
Original file line number Diff line number Diff line change
1
+ from calculator import add , div , mul , sub
2
+
3
+
4
+ def test_add ():
5
+ assert add (1 , 1 ) == 2
6
+
7
+
8
+ def test_sub ():
9
+ assert sub (1 , 1 ) == 0
10
+
11
+
12
+ def test_mul ():
13
+ assert mul (1 , 1 ) == 1
14
+
15
+
16
+ def test_div ():
17
+ assert div (2 , 1 ) == 2
You can’t perform that action at this time.
0 commit comments