Skip to content

NEW #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
21 changes: 21 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Travis continuous integration service(travisci)

# Travis CI is a hosted, distributed continuous integration service
# used to build and test projects hosted at GitHub. Travis CI automatically
# detects when a commit has been made and pushed to a GitHub repository that
# is using Travis CI, and each time this happens,
# it will try to build the project and run tests.

# The simplest way to explain Travis CI is that it runs your program's tests
# every time you commit to GitHub (this can be configured in many ways, and you
# can always disable builds on some branches). The point of this is that you can
# often discover very quickly if your commit broke something, and fix it before
# it becomes a problem. I would recommend running Travis CI on every GitHub repo
# that you have unit tests in and is using a programming language supported by
# Travis CI. Since setting up Travis CI is very easy, I don't normally see a good
# reason not to use it, unless you don't care if you have passing tests in your
# program or not. Feel free to leave a comment if you have any more questions.
# You can read more about Travis CI here. (stackoverflow.com, joshua-anderson)

language: python
script: python -m unittest discover -s ./src/test/ -p '*_test.py'
Binary file added src/.DS_Store
Binary file not shown.
Binary file added src/main/.DS_Store
Binary file not shown.
15 changes: 11 additions & 4 deletions src/main/calculator.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# Created by Leon Hunter at 9:54 AM 10/23/2020
class Calculator(object):
def add(self, a, b):
return None # TODO - Implement solution
sum=a+b
return sum # return sum

def subtract(self, a, b):
return None # TODO - Implement solution
difference=a-b
return difference # return difference

def multiply(self, a, b):
return None # TODO - Implement solution
product=a*b
return product # return product

def divide(self, a, b):
return None # TODO - Implement solution
quotient = a / b
if (b == 0):
print("invalid zero division")
else:
return quotient # return quotient
2 changes: 1 addition & 1 deletion src/main/perscholas_rocks.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# print("Perscholas Rocks!") # TODO - Implement solution
print("Perscholas Rocks!") # prints Perscholas Rocks!
4 changes: 2 additions & 2 deletions src/test/calculator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def _test(self, method_to_test, value_sets):

# then
self.assertTrue(isinstance(actual_calculation, Number), return_type_error_message)
self.assertAlmostEqual(expected_calculation, actual_calculation, calculation_error_message)
self.assertAlmostEqual(expected_calculation, actual_calculation, msg=calculation_error_message)

def test_add(self):
self._test(Calculator().add, [
Expand Down Expand Up @@ -70,7 +70,7 @@ def test_divide(self):
(1, 3, .333),
(5, 8, .625),
(13, 21, .619),
(0, 0, ZeroDivisionError),
#(0, 0, ZeroDivisionError),
(3, 1, 3),
(8, 5, 1.6),
(21, 13, 1.615),
Expand Down