Quoting @denis-roy's pull request #157, regarding the Python 3 version of AboutWithStatements.test_finding_lines2:
The default placeholder value of __ can be left as is and the test will pass.
And from his comment in the file itself:
[...] In fact it accepts anything that is not 'test\n' as an answer.
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 furthermore the return value is correct. That would be more clear if:
- The general test appeared before the specific test.
...and maybe:
- They both asserted the expected value.
Something like:
def test_finding_lines2(self):
self.assertNotEqual(None, self.find_line2("example_file.txt"))
self.assertEqual("test\n", self.find_line2("example_file.txt"))
This should focus the student's attention entirely on rewriting find_line2.
Quoting @denis-roy's pull request #157, regarding the Python 3 version of
AboutWithStatements.test_finding_lines2:And from his comment in the file itself:
The Python 2 version of the same test explicitly asserts that the user-written function does not return
None:I think the idea was that the
assertNotEqualwould test that the student-written function returns anything, while theassertEqualwould test that furthermore the return value is correct. That would be more clear if:...and maybe:
Something like:
This should focus the student's attention entirely on rewriting
find_line2.