diff options
author | Shadab Zafar <dufferzafar0@gmail.com> | 2016-06-02 13:00:44 +0530 |
---|---|---|
committer | Shadab Zafar <dufferzafar0@gmail.com> | 2016-06-02 13:00:44 +0530 |
commit | b510616c69135ff2e8f18da3a5fd9a19ddcdfc63 (patch) | |
tree | 7c045e10900bed0b6357aa2c66803cf0b6e6fa01 /test/pathod | |
parent | a04d7fd166498b54316571a4e71a58837cf11df8 (diff) | |
download | mitmproxy-b510616c69135ff2e8f18da3a5fd9a19ddcdfc63.tar.gz mitmproxy-b510616c69135ff2e8f18da3a5fd9a19ddcdfc63.tar.bz2 mitmproxy-b510616c69135ff2e8f18da3a5fd9a19ddcdfc63.zip |
Py3: Return bytes from FileGenerator
and use __getitem__ instead of __getslice__
Diffstat (limited to 'test/pathod')
-rw-r--r-- | test/pathod/test_language_generators.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/test/pathod/test_language_generators.py b/test/pathod/test_language_generators.py index 33ab4879..51f55991 100644 --- a/test/pathod/test_language_generators.py +++ b/test/pathod/test_language_generators.py @@ -19,13 +19,15 @@ def test_filegenerator(): with tutils.tmpdir() as t: path = os.path.join(t, "foo") f = open(path, "wb") - f.write("x" * 10000) + f.write(b"x" * 10000) f.close() g = generators.FileGenerator(path) assert len(g) == 10000 - assert g[0] == "x" - assert g[-1] == "x" - assert g[0:5] == "xxxxx" + assert g[0] == b"x" + assert g[-1] == b"x" + assert g[0:5] == b"xxxxx" + assert len(g[1:10]) == 9 + assert len(g[10000:10001]) == 0 assert repr(g) # remove all references to FileGenerator instance to close the file # handle. |