Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Close open test files

  • Loading branch information...
commit cd7997d770f12690afd563bd339667cc58bc2c28 1 parent c52e800
@miso-belica miso-belica authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 test.py
View
10 test.py
@@ -25,11 +25,13 @@ def __init__(self, file_name, encoding):
def runTest(self):
u = UniversalDetector()
- for line in open(self.file_name, 'rb'):
- u.feed(line)
- if u.done:
- break
+ with open(self.file_name, 'rb') as file:
+ for line in file:
+ u.feed(line)
+ if u.done:
+ break
u.close()
+
self.assertEqual(u.result['encoding'].lower(), self.encoding,
"Expected %s, but got %r in %s" %
(self.encoding, u.result['encoding'],

0 comments on commit cd7997d

Please sign in to comment.
Something went wrong with that request. Please try again.