linter: Fix UnicodeError when parsing comments

And add tests when reading non-ASCII strings and comments (both from
Python strings and from files).

Fixes: #10
This commit is contained in:
Adrien Vergé
2016-06-28 09:58:23 +02:00
parent 63dd8313f8
commit c8ba8f7e99
4 changed files with 43 additions and 3 deletions

View File

@@ -49,7 +49,7 @@ class Comment(object):
self.token_after = token_after
self.comment_before = comment_before
def __repr__(self):
def __str__(self):
end = self.buffer.find('\n', self.pointer)
if end == -1:
end = self.buffer.find('\0', self.pointer)