Skip to content

pull request for lesson 5 #22

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 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c3fde5b
checking git
jjame369 Apr 3, 2019
669fb2a
updating for homework
jjame369 Apr 10, 2019
f170bd4
updating hw
jjame369 Apr 11, 2019
0aa25d7
updating hw
jjame369 Apr 12, 2019
d57dc11
updating linting hw
jjame369 Apr 12, 2019
7857737
updating linting hw
jjame369 Apr 12, 2019
f00ed8c
updating linting hw
jjame369 Apr 12, 2019
44dcb00
updating linting hw
jjame369 Apr 16, 2019
b3682fd
updating linting hw
jjame369 Apr 16, 2019
5d26139
updating linting hw
jjame369 Apr 16, 2019
045fd8b
updating linting hw
jjame369 Apr 17, 2019
8207a10
updating linting hw
jjame369 Apr 17, 2019
d134f52
updating for homework
jjame369 Apr 18, 2019
bcd5673
Beggining new project, updating git.
jjame369 Apr 20, 2019
f825ba5
adding a customer information mode file
jjame369 Apr 20, 2019
32bf89d
adding a customer information mode file
jjame369 Apr 24, 2019
9de9174
adding a customer information mode file
jjame369 May 3, 2019
4465a41
cleaning up directory
jjame369 May 3, 2019
6d94e13
cleaning up directory
jjame369 May 3, 2019
a171444
cleaning up directory
jjame369 May 3, 2019
521559f
cleaning up directory
jjame369 May 3, 2019
72bc906
cleaning up directory
jjame369 May 3, 2019
55d7b9f
Refactoring unit test
jjame369 May 9, 2019
3a798cb
commiting for refactoring
jjame369 May 9, 2019
156f1a4
Refactoring unit test
jjame369 May 10, 2019
8a38593
uploading lesson 4
jjame369 May 10, 2019
e9f3d79
setting up lesson 05
jjame369 May 12, 2019
7f51331
got the lists into dicts and got mongo up and running. need to put i…
jjame369 May 15, 2019
09677a9
got the lists into dicts and got mongo up and running. need to put i…
jjame369 May 15, 2019
456bd65
created a class for Mongo info then called lists of dictionaries
jjame369 May 18, 2019
c55f37d
created a class for Mongo info then called lists of dictionaries
jjame369 May 18, 2019
f8a8f2c
added a class to take care of the Mongo stuff, then called informatio…
jjame369 May 18, 2019
2fe9c4a
Add files via upload
jjame369 May 29, 2019
fc630d9
Add files via upload
jjame369 Jun 8, 2019
e0506cb
Add files via upload
jjame369 Jun 8, 2019
798f2fd
Add files via upload
jjame369 Jun 8, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions students/Justin_Jameson/lesson01/activity/.idea/activity.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions students/Justin_Jameson/lesson01/activity/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions students/Justin_Jameson/lesson01/activity/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions students/Justin_Jameson/lesson01/activity/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions students/Justin_Jameson/lesson01/activity/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

568 changes: 568 additions & 0 deletions students/Justin_Jameson/lesson01/activity/.idea/workspace.xml

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .exceptions import InsufficientOperands


class Calculator(object):

def __init__(self, adder, subtracter, multiplier, divider):
Expand All @@ -11,7 +12,7 @@ def __init__(self, adder, subtracter, multiplier, divider):
self.stack = []

def enter_number(self, number):
self.stack.insert(0, number)
self.stack.insert(1, number)

def _do_calc(self, operator):
try:
Expand All @@ -31,5 +32,5 @@ def subtract(self):
def multiply(self):
return self._do_calc(self.multiplier)

def divide(self):
def divider(self):
return self._do_calc(self.divider)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
37 changes: 37 additions & 0 deletions ...te_student/lesson01/activity/test_unit.py → ...in_Jameson/lesson01/activity/test_unit.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from calculator.calculator import Calculator
from calculator.exceptions import InsufficientOperands


class AdderTests(TestCase):

def test_adding(self):
Expand All @@ -28,6 +29,26 @@ def test_subtracting(self):
self.assertEqual(i - j, subtracter.calc(i, j))


class MultiplierTests(TestCase):

def test_multiplying(self):
multiplier = Multiplier()

for i in range(-10, 10):
for j in range(-10, 10):
self.assertEqual(i * j, multiplier.calc(i, j))


class DividerTests(TestCase):

def test_dividing(self):
divider = Divider()

for i in range(-10, 10):
for j in range(1, 21):
self.assertEqual(i / j, divider.calc(i, j))


class CalculatorTests(TestCase):

def setUp(self):
Expand Down Expand Up @@ -62,4 +83,20 @@ def test_subtracter_call(self):

self.subtracter.calc.assert_called_with(1, 2)

def test_multiplier_call(self):
self.multiplier.calc = MagicMock(return_value=0)

self.calculator.enter_number(1)
self.calculator.enter_number(2)
self.calculator.multiply()

self.multiplier.calc.assert_called_with(1, 2)

def test_divider_call(self):
self.divider.calc = MagicMock(return_value=0)

self.calculator.enter_number(1)
self.calculator.enter_number(2)
self.calculator.divider()

self.divider.calc.assert_called_with(1, 2)
Binary file not shown.
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading