Skip to content

Commit 5f574c7

Browse files
yudhieshfrpalmap
authored andcommitted
Update base repository (sb2nov#7)
1 parent d4ec422 commit 5f574c7

File tree

4 files changed

+120
-23
lines changed

4 files changed

+120
-23
lines changed

.github/workflows/ci_cd_wf.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name : test
1+
name: test
22

33
on:
44
push:
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
test:
10-
runs-on : ubuntu-latest
10+
runs-on: ubuntu-latest
1111

1212
steps:
1313
- name: Check out repo code
@@ -23,4 +23,4 @@ jobs:
2323
python -m pip install -r requirements.txt
2424
- name: Run tests
2525
run: |
26-
python -m pytest calculator.py
26+
python -m pytest tests

.gitignore

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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+

calculator.py

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,29 @@
11
# Demo Calculator App For Week 1 Project
22
# Addition Method
33
def add(a, b):
4-
return (a + b)
4+
return a + b
5+
56

67
# Subtract Method
78
def sub(a, b):
8-
return (a - b)
9+
return a - b
10+
911

1012
# Multiplication
1113
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
2015

21-
def test_sub():
22-
assert sub(1,1) == 0
2316

24-
def test_mul():
25-
assert mul(1,1) == 1
17+
# Division
18+
def div(a, b):
19+
return a / b
2620

27-
def test_div():
28-
assert div(2,1) == 2
2921

3022
if __name__ == "__main__":
3123
# Declare variable and set default values
3224
a = 4
3325
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))

tests/test_calculator.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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

0 commit comments

Comments
 (0)