From fe7d193d1aab0cdd7579fef3ec56e83c77f0134c Mon Sep 17 00:00:00 2001 From: Greg Ward Date: Thu, 16 Jul 2015 14:49:48 -0400 Subject: [PATCH] Add several more test cases for issue #163. --- tests/unit/test_serialize.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/unit/test_serialize.py b/tests/unit/test_serialize.py index 6e4795e..3e03adb 100644 --- a/tests/unit/test_serialize.py +++ b/tests/unit/test_serialize.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- import pytest from vcr.compat import mock @@ -54,6 +55,19 @@ interactions: ('x=5&y=2', b'x=5&y=2'), # Cassette written under Python 3 (pure ASCII body) ('!!binary |\n eD01Jnk9Mg==', b'x=5&y=2'), + + # Request body has non-ASCII chars (x=föo&y=2), encoded in UTF-8. + ('!!python/str "x=f\\xF6o&y=2"', b'x=f\xc3\xb6o&y=2'), + ('!!binary |\n eD1mw7ZvJnk9Mg==', b'x=f\xc3\xb6o&y=2'), + + # Same request body, this time encoded in UTF-16. In this case, we + # write the same YAML file under both Python 2 and 3, so there's only + # one test case here. + ('!!binary |\n //54AD0AZgD2AG8AJgB5AD0AMgA=', + b'\xff\xfex\x00=\x00f\x00\xf6\x00o\x00&\x00y\x00=\x002\x00'), + + # Same again, this time encoded in ISO-8859-1. + ('!!binary |\n eD1m9m8meT0y', b'x=f\xf6o&y=2'), ]) def test_deserialize_py2py3_yaml_cassette(tmpdir, req_body, expect): cfile = tmpdir.join('test_cassette.yaml')