def test_utf8_unicode(self): stdout = Mock(encoding='latin-1') cfg = config.Config(stdout=stdout) cfg.print_stdout(compat.u("méil %s %s"), "x", "y") eq_(stdout.mock_calls, [call.write(compat.u('méil x y')), call.write('\n')])
def test_utf8_unicode(self): stdout = Mock(encoding='latin-1') cfg = config.Config(stdout=stdout) cfg.print_stdout(compat.u("méil %s %s"), "x", "y") eq_( stdout.mock_calls, [call.write(compat.u('méil x y')), call.write('\n')] )
def test_utf8_unicode(self): stdout = mock.Mock(encoding="latin-1") cfg = config.Config(stdout=stdout) cfg.print_stdout(compat.u("méil %s %s"), "x", "y") eq_( stdout.mock_calls, [mock.call.write(compat.u("méil x y")), mock.call.write("\n")], )
def test_encode(self): with capture_context_buffer( bytes_io=True, output_encoding='utf-8' ) as buf: command.upgrade(self.cfg, self.a, sql=True) assert compat.u("« S’il vous plaît…").encode("utf-8") in buf.getvalue()
def setUp(self): self.env = staging_env() self.cfg = cfg = _no_sql_testing_config() cfg.set_main_option("dialect_name", "sqlite") cfg.remove_main_option("url") self.a = util.rev_id() script = ScriptDirectory.from_config(cfg) script.generate_revision(self.a, "revision a", refresh=True) write_script( script, self.a, (compat.u("""# coding: utf-8 from __future__ import unicode_literals revision = '%s' down_revision = None from alembic import op def upgrade(): op.execute("« S’il vous plaît…") def downgrade(): op.execute("drôle de petite voix m’a réveillé") """) % self.a), encoding="utf-8", )
def setUp(self): self.env = staging_env() self.cfg = cfg = _no_sql_testing_config() cfg.set_main_option("dialect_name", "sqlite") cfg.remove_main_option("url") self.a = util.rev_id() script = ScriptDirectory.from_config(cfg) script.generate_revision(self.a, "revision a", refresh=True) write_script( script, self.a, ( compat.u( """# coding: utf-8 from __future__ import unicode_literals revision = '%s' down_revision = None from alembic import op def upgrade(): op.execute("« S’il vous plaît…") def downgrade(): op.execute("drôle de petite voix m’a réveillé") """ ) % self.a ), encoding="utf-8", )
def test_ascii_unicode(self): stdout = Mock(encoding=None) cfg = config.Config(stdout=stdout) cfg.print_stdout(compat.u("méil %s %s"), "x", "y") eq_( stdout.mock_calls, [call.write('m?il x y'), call.write('\n')] )
def test_only_formats_output_with_args(self): stdout = mock.Mock(encoding=None) cfg = config.Config(stdout=stdout) cfg.print_stdout(compat.u("test 3%")) eq_( stdout.mock_calls, [mock.call.write("test 3%"), mock.call.write("\n")], )
def test_ascii_unicode(self): stdout = mock.Mock(encoding=None) cfg = config.Config(stdout=stdout) cfg.print_stdout(compat.u("méil %s %s"), "x", "y") eq_( stdout.mock_calls, [mock.call.write("m?il x y"), mock.call.write("\n")], )
def test_only_formats_output_with_args(self): stdout = Mock(encoding=None) cfg = config.Config(stdout=stdout) cfg.print_stdout(compat.u("test 3%")) eq_(stdout.mock_calls, [call.write('test 3%'), call.write('\n')])
def test_only_formats_output_with_args(self): stdout = Mock(encoding=None) cfg = config.Config(stdout=stdout) cfg.print_stdout(compat.u("test 3%")) eq_(stdout.mock_calls, [call.write("test 3%"), call.write("\n")])