From b33c38b35fe543874e02abf4a8c7738692246eb9 Mon Sep 17 00:00:00 2001 From: Jeff Dairiki Date: Sun, 1 Sep 2013 02:33:50 -0700 Subject: [PATCH] The str.encode() method does not accept keyword args in python < 2.7 --- alembic/util.py | 2 +- tests/test_command.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/alembic/util.py b/alembic/util.py index bd2f0358..a8750a2c 100644 --- a/alembic/util.py +++ b/alembic/util.py @@ -127,7 +127,7 @@ def write_outstream(stream, *text): encoding = getattr(stream, 'encoding', 'ascii') or 'ascii' for t in text: if not isinstance(t, binary_type): - t = t.encode(encoding, errors='replace') + t = t.encode(encoding, 'replace') t = t.decode(encoding) stream.write(t) diff --git a/tests/test_command.py b/tests/test_command.py index 1179b6e0..53a95386 100644 --- a/tests/test_command.py +++ b/tests/test_command.py @@ -26,11 +26,11 @@ class StdoutCommandTest(unittest.TestCase): # test default encode/decode behavior as well, # rev B has a non-ascii char in it + a coding header. eq_( - buf.getvalue().decode("ascii", errors='replace').strip(), + buf.getvalue().decode("ascii", 'replace').strip(), "\n".join([ script.get_revision(rev).log_entry for rev in expected - ]).encode("ascii", errors="replace").decode("ascii").strip() + ]).encode("ascii", "replace").decode("ascii").strip() ) def _buf_fixture(self): -- 2.47.2