Skip to content

Commit ff7e4ab

Browse files
authored
Merge pull request #170 from kjc/with_context_manager
Python 3 test_finding_lines2() assert passes as-is
2 parents 602498b + 875f163 commit ff7e4ab

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

python2/koans/about_with_statements.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,13 @@ def test_counting_lines2(self):
9191
# ------------------------------------------------------------------
9292

9393
def find_line2(self, file_name):
94-
# Rewrite find_line using the Context Manager.
95-
pass
94+
# Using the context manager self.FileContextManager, rewrite this
95+
# function to return the first line containing the letter 'e'.
96+
return None
9697

9798
def test_finding_lines2(self):
98-
self.assertEqual(__, self.find_line2("example_file.txt"))
9999
self.assertNotEqual(None, self.find_line2("example_file.txt"))
100+
self.assertEqual('test\n', self.find_line2("example_file.txt"))
100101

101102
# ------------------------------------------------------------------
102103

python3/koans/about_with_statements.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,13 @@ def test_counting_lines2(self):
9090
# ------------------------------------------------------------------
9191

9292
def find_line2(self, file_name):
93-
# Rewrite find_line using the Context Manager.
94-
pass
93+
# Using the context manager self.FileContextManager, rewrite this
94+
# function to return the first line containing the letter 'e'.
95+
return None
9596

9697
def test_finding_lines2(self):
97-
self.assertEqual(__, self.find_line2("example_file.txt"))
98-
self.assertNotEqual(__, self.find_line2("example_file.txt"))
98+
self.assertNotEqual(None, self.find_line2("example_file.txt"))
99+
self.assertEqual('test\n', self.find_line2("example_file.txt"))
99100

100101
# ------------------------------------------------------------------
101102

0 commit comments

Comments
 (0)