Skip to content

Commit e276116

Browse files
beaucarnesShMcK
authored andcommitted
L1S1Q
1 parent c54e886 commit e276116

File tree

5 files changed

+29
-2
lines changed

5 files changed

+29
-2
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
package-lock.json
3+
.DS_Store

coderoad/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ init:
22
pip install -r requirements.txt
33

44
test:
5-
python tests
5+
python tests

coderoad/src/example.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Solution
21
def add(*args):
32
'''Add 1 or more numbers together'''
43
sum = 0

coderoad/tests/context.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import sys
2+
import os
3+
sys.path.insert(0, os.path.abspath(
4+
os.path.join(os.path.dirname(__file__), '..')))
5+
6+
import src

coderoad/tests/math_test.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import unittest
2+
import sys
3+
sys.path.append('./coderoad/src')
4+
5+
from example import add
6+
7+
8+
class MathTest(unittest.TestCase):
9+
def test_add_no_numbers(self):
10+
self.assertEqual(add(), 0, "Should return 0 with no params")
11+
def test_add_one_number(self):
12+
self.assertEqual(add(1), 1, "Should add one number to 0")
13+
def test_add_two_numbers(self):
14+
self.assertEqual(add(1, 2), 3, "Should add two numbers together")
15+
def test_add_three_numbers(self):
16+
self.assertEqual(add(1, 2, 3), 6, "Should add three numbers together")
17+
18+
if __name__ == '__main__':
19+
unittest.main()

0 commit comments

Comments
 (0)