From c54e88699bf106b367e03651c6f2ad67f444cc87 Mon Sep 17 00:00:00 2001 From: Beau Carnes Date: Mon, 15 Jun 2020 16:48:23 -0400 Subject: [PATCH 1/3] INIT setup --- coderoad/Makefile | 5 +++++ coderoad/pyvenv.cfg | 3 +++ coderoad/requirements.txt | 10 ++++++++++ coderoad/src/example.py | 16 ++++++++++++++++ 4 files changed, 34 insertions(+) create mode 100644 coderoad/Makefile create mode 100644 coderoad/pyvenv.cfg create mode 100644 coderoad/requirements.txt create mode 100644 coderoad/src/example.py diff --git a/coderoad/Makefile b/coderoad/Makefile new file mode 100644 index 0000000..fb2be7b --- /dev/null +++ b/coderoad/Makefile @@ -0,0 +1,5 @@ +init: + pip install -r requirements.txt + +test: + python tests \ No newline at end of file diff --git a/coderoad/pyvenv.cfg b/coderoad/pyvenv.cfg new file mode 100644 index 0000000..2518a82 --- /dev/null +++ b/coderoad/pyvenv.cfg @@ -0,0 +1,3 @@ +home = /usr/local/bin +include-system-site-packages = false +version = 3.7.7 \ No newline at end of file diff --git a/coderoad/requirements.txt b/coderoad/requirements.txt new file mode 100644 index 0000000..9b14c1a --- /dev/null +++ b/coderoad/requirements.txt @@ -0,0 +1,10 @@ +astroid==2.4.2 +isort==4.3.21 +lazy-object-proxy==1.4.3 +mccabe==0.6.1 +pylint==2.5.3 +six==1.15.0 +tap.py==3.0 +toml==0.10.1 +typed-ast==1.4.1 +wrapt==1.12.1 \ No newline at end of file diff --git a/coderoad/src/example.py b/coderoad/src/example.py new file mode 100644 index 0000000..f2268b1 --- /dev/null +++ b/coderoad/src/example.py @@ -0,0 +1,16 @@ +# Solution +def add(*args): + '''Add 1 or more numbers together''' + sum = 0 + for arg in args: + sum += arg + return sum + +def main(): + print('hello') + print(str(add(1))) + print(str(add(1, 2))) + print(str(add(1, 2, 3))) + +if __name__ == '__main__': + main() \ No newline at end of file From e276116f9a8ae0be13011d9fde7b4eccb4cfa2f0 Mon Sep 17 00:00:00 2001 From: Beau Carnes Date: Mon, 15 Jun 2020 15:38:43 -0400 Subject: [PATCH 2/3] L1S1Q --- .gitignore | 3 +++ coderoad/Makefile | 2 +- coderoad/src/example.py | 1 - coderoad/tests/context.py | 6 ++++++ coderoad/tests/math_test.py | 19 +++++++++++++++++++ 5 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 .gitignore create mode 100644 coderoad/tests/context.py create mode 100644 coderoad/tests/math_test.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..373c5df --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules +package-lock.json +.DS_Store \ No newline at end of file diff --git a/coderoad/Makefile b/coderoad/Makefile index fb2be7b..64a7d49 100644 --- a/coderoad/Makefile +++ b/coderoad/Makefile @@ -2,4 +2,4 @@ init: pip install -r requirements.txt test: - python tests \ No newline at end of file + python tests diff --git a/coderoad/src/example.py b/coderoad/src/example.py index f2268b1..54e987b 100644 --- a/coderoad/src/example.py +++ b/coderoad/src/example.py @@ -1,4 +1,3 @@ -# Solution def add(*args): '''Add 1 or more numbers together''' sum = 0 diff --git a/coderoad/tests/context.py b/coderoad/tests/context.py new file mode 100644 index 0000000..56d9144 --- /dev/null +++ b/coderoad/tests/context.py @@ -0,0 +1,6 @@ +import sys +import os +sys.path.insert(0, os.path.abspath( + os.path.join(os.path.dirname(__file__), '..'))) + +import src \ No newline at end of file diff --git a/coderoad/tests/math_test.py b/coderoad/tests/math_test.py new file mode 100644 index 0000000..206228b --- /dev/null +++ b/coderoad/tests/math_test.py @@ -0,0 +1,19 @@ +import unittest +import sys +sys.path.append('./coderoad/src') + +from example import add + + +class MathTest(unittest.TestCase): + def test_add_no_numbers(self): + self.assertEqual(add(), 0, "Should return 0 with no params") + def test_add_one_number(self): + self.assertEqual(add(1), 1, "Should add one number to 0") + def test_add_two_numbers(self): + self.assertEqual(add(1, 2), 3, "Should add two numbers together") + def test_add_three_numbers(self): + self.assertEqual(add(1, 2, 3), 6, "Should add three numbers together") + +if __name__ == '__main__': + unittest.main() \ No newline at end of file From 6fa820568c7fb234a9a3de039f6d3e0bc3a03fea Mon Sep 17 00:00:00 2001 From: Beau Carnes Date: Mon, 15 Jun 2020 15:42:10 -0400 Subject: [PATCH 3/3] L1S1A --- coderoad/src/example.py | 1 + 1 file changed, 1 insertion(+) diff --git a/coderoad/src/example.py b/coderoad/src/example.py index 54e987b..b4e8f8b 100644 --- a/coderoad/src/example.py +++ b/coderoad/src/example.py @@ -1,3 +1,4 @@ +# Solution def add(*args): '''Add 1 or more numbers together''' sum = 0