Skip to content
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

complex-numbers: check test version and update #1057

Merged
merged 11 commits into from
Nov 7, 2017

Conversation

trangttt
Copy link
Contributor

@ilya-khadykin
Copy link
Contributor

@trangttt thanks for the PR
build failed due to the following:

3.06s$ flake8
./exercises/complex-numbers/complex_numbers_test.py:9:1: E302 expected 2 blank lines, found 1

The command "flake8" failed and exited with 1 during .
Your build has been stopped.

input_number = ComplexNumber(0, 1)
self.assertEqual(input_number.imaginary, 1)

def test_maginary_part_of_a_number_with_real_and_imaginary_part(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling error that wasn't caught in the previous version of this file. Should be

def test_imaginary_part_of_a_number_with_real_and_imaginary_part(self):

@@ -4,74 +4,64 @@

from complex_numbers import ComplexNumber

# Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move the comment down by a line for the sake of consistency? (ie. two blank rows before, one after)

@@ -126,13 +116,37 @@ def test_conjugate_a_purely_imaginary_number(self):
self.assertEqual(expected.imaginary,
input_number.conjugate().imaginary)

def conjugate_a_number_with_real_and_imaginary_part(self):
def test_conjugate_a_number_with_real_and_imaginary_part(self):
input_number = ComplexNumber(1, 1)
expected = ComplexNumber(1, -1)
self.assertEqual(expected.real, input_number.conjugate().real)
self.assertEqual(expected.imaginary,
input_number.conjugate().imaginary)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you swap the arguments in these asserts? They should follow the convention of assertEqual(actual, expected). This should also be done for the division tests above.

Copy link
Contributor

@N-Parsons N-Parsons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a couple of minor points to resolve, and then this will be ready for merge.

@N-Parsons
Copy link
Contributor

@trangttt, are you still working on this? It just needs a few minor changes and then it can be merged.

@trangttt
Copy link
Contributor Author

trangttt commented Nov 6, 2017

Sorry for this late update. The email was buried in my mailbox so I didn't notice. Please tell me if I need to update anything.

self.assertEqual(first_input.mul(second_input).imaginary, 0)
second_input = ComplexNumber(3, 4)
self.assertEqual(first_input.mul(second_input).real, -5)
self.assertEqual(first_input.mul(second_input).imaginary, 10)

def test_divide_purely_real_numbers(self):
input_number = ComplexNumber(1.0, 0.0)
Copy link
Contributor

@N-Parsons N-Parsons Nov 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you swap the order the arguments in these methods to match the convention assertEqual(actual, expected)?

GitHub's displayed code section isn't very helpful here. I'm referring to the division tests (these were already up-to-date, but don't match the conventions).

@N-Parsons
Copy link
Contributor

@trangttt, can you swap the argument order in the division tests to match the assertEqual(actual, expected) convention? Once that's done, this PR will be ready to merge.

@N-Parsons
Copy link
Contributor

Perfect! Thanks, @trangttt!

@N-Parsons N-Parsons merged commit ede22d4 into exercism:master Nov 7, 2017
smalley pushed a commit to smalley/python that referenced this pull request Nov 12, 2017
* complex-numbers: check test version and update

* Swap the order of expected and actual value in assertEqual
smalley pushed a commit to smalley/python that referenced this pull request Nov 12, 2017
* complex-numbers: check test version and update

* Swap the order of expected and actual value in assertEqual
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants