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

about_with_statement.py has a boken test on line 98 #157

Closed
wants to merge 1 commit into from
Closed

about_with_statement.py has a boken test on line 98 #157

wants to merge 1 commit into from

Conversation

denis-roy
Copy link

The default placeholder value of __ can be left as is and the test will pass. I might be mistaken but it seems like an unexpected behavior to me..?

The default placeholder value of __ can be left as is and the test will pass. I might be mistaken but it seems like an unexpected behavior to me..?
@denis-roy denis-roy changed the title Commented out the broken test about_with_statement.py has a boken test on line 98 Jun 14, 2017
@kjc
Copy link
Collaborator

kjc commented Feb 11, 2018

The Python 2 version of the same test explicitly asserts that the user-written function does not return None:

def find_line2(self, file_name):
    # Rewrite find_line using the Context Manager.
    pass

def test_finding_lines2(self):
    self.assertEqual(__, self.find_line2("example_file.txt"))
    self.assertNotEqual(None, self.find_line2("example_file.txt"))

I think the idea was that the assertNotEqual would test that the student-written function returns anything, while the assertEqual would test that, in addition, the return value is correct. That would be more clear if they appeared in the opposite order.

PS: This should really be an issue (used for pointing out problems), not a pull request (used for fixes or other improvements). I'll create one now.

@kjc kjc closed this Feb 11, 2018
kjc added a commit to kjc/python_koans that referenced this pull request Feb 11, 2018
Fixes issue gregmalcolm#169, reported in @denis-roy's pull request gregmalcolm#157:  The
Python 3 version of AboutWithStatements.test_finding_lines2 contains an
assertNotEqual(__, ...) that passes without the student having to
change anything.

I think the idea was that the assertNotEqual would test that the
student-written function returns _anything_ (by default, the pass
statement returns None), while the assertEqual would test that
furthermore the return value is correct.

In this version, the general (not-None) assertion is tested before the
specific.  Also, both assertions have the passing / expected values
hard-coded, meaning the student should change only the function they
test, not the assertions themselves.
@denis-roy denis-roy deleted the drts-broken-test branch February 11, 2018 23:47
bjbishop pushed a commit to bjbishop/python_koans that referenced this pull request Oct 21, 2022
Fixes issue gregmalcolm#169, reported in @denis-roy's pull request gregmalcolm#157:  The
Python 3 version of AboutWithStatements.test_finding_lines2 contains an
assertNotEqual(__, ...) that passes without the student having to
change anything.

I think the idea was that the assertNotEqual would test that the
student-written function returns _anything_ (by default, the pass
statement returns None), while the assertEqual would test that
furthermore the return value is correct.

In this version, the general (not-None) assertion is tested before the
specific.  Also, both assertions have the passing / expected values
hard-coded, meaning the student should change only the function they
test, not the assertions themselves.
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.

None yet

2 participants