summaryrefslogtreecommitdiff
path: root/tests/commands
diff options
context:
space:
mode:
authorLucas Hoffmann <lucc@posteo.de>2019-11-04 08:00:10 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2019-11-06 10:54:00 +0000
commit414ca6c4b57752d139598e95e06009c55ff4543c (patch)
treea77d60aaf05f2c75224df95f7481f7328e414e7a /tests/commands
parentbbb96525c08f0c6ee9fc93e0dd0ccb3abfd1dca8 (diff)
Remove unicode literals syntax from python2
Diffstat (limited to 'tests/commands')
-rw-r--r--tests/commands/test_envelope.py16
-rw-r--r--tests/commands/test_global.py28
-rw-r--r--tests/commands/test_init.py2
-rw-r--r--tests/commands/test_thread.py78
4 files changed, 62 insertions, 62 deletions
diff --git a/tests/commands/test_envelope.py b/tests/commands/test_envelope.py
index a5d86d94..d14cbf1f 100644
--- a/tests/commands/test_envelope.py
+++ b/tests/commands/test_envelope.py
@@ -120,28 +120,28 @@ class TestTagCommands(unittest.TestCase):
self.assertListEqual(sorted(actual), sorted(expected))
def test_add_new_tags(self):
- self._test(u'four', 'add', ['one', 'two', 'three', 'four'])
+ self._test('four', 'add', ['one', 'two', 'three', 'four'])
def test_adding_existing_tags_has_no_effect(self):
- self._test(u'one', 'add', ['one', 'two', 'three'])
+ self._test('one', 'add', ['one', 'two', 'three'])
def test_remove_existing_tags(self):
- self._test(u'one', 'remove', ['two', 'three'])
+ self._test('one', 'remove', ['two', 'three'])
def test_remove_non_existing_tags_has_no_effect(self):
- self._test(u'four', 'remove', ['one', 'two', 'three'])
+ self._test('four', 'remove', ['one', 'two', 'three'])
def test_set_tags(self):
- self._test(u'a,b,c', 'set', ['a', 'b', 'c'])
+ self._test('a,b,c', 'set', ['a', 'b', 'c'])
def test_toggle_will_remove_existing_tags(self):
- self._test(u'one', 'toggle', ['two', 'three'])
+ self._test('one', 'toggle', ['two', 'three'])
def test_toggle_will_add_new_tags(self):
- self._test(u'four', 'toggle', ['one', 'two', 'three', 'four'])
+ self._test('four', 'toggle', ['one', 'two', 'three', 'four'])
def test_toggle_can_remove_and_add_in_one_run(self):
- self._test(u'one,four', 'toggle', ['two', 'three', 'four'])
+ self._test('one,four', 'toggle', ['two', 'three', 'four'])
class TestSignCommand(unittest.TestCase):
diff --git a/tests/commands/test_global.py b/tests/commands/test_global.py
index 07b0df2a..94ad0672 100644
--- a/tests/commands/test_global.py
+++ b/tests/commands/test_global.py
@@ -84,12 +84,12 @@ class TestComposeCommand(unittest.TestCase):
self.assertIs(envelope.sign_key, None)
def test_get_template_decode(self):
- subject = u'This is a täßϑ subject.'
- to = u'recipient@mail.com'
- _from = u'foo.bar@mail.fr'
- body = u'Body\n地初店会継思識棋御招告外児山望掲領環。\n€mail body €nd.'
+ subject = 'This is a täßϑ subject.'
+ to = 'recipient@mail.com'
+ _from = 'foo.bar@mail.fr'
+ body = 'Body\n地初店会継思識棋御招告外児山望掲領環。\n€mail body €nd.'
with tempfile.NamedTemporaryFile('wb', delete=False) as f:
- txt = u'Subject: {}\nTo: {}\nFrom: {}\n{}'.format(subject, to,
+ txt = 'Subject: {}\nTo: {}\nFrom: {}\n{}'.format(subject, to,
_from, body)
f.write(txt.encode('utf-8'))
self.addCleanup(os.unlink, f.name)
@@ -109,14 +109,14 @@ class TestExternalCommand(unittest.TestCase):
@utilities.async_test
async def test_no_spawn_no_stdin_success(self):
ui = utilities.make_ui()
- cmd = g_commands.ExternalCommand(u'true', refocus=False)
+ cmd = g_commands.ExternalCommand('true', refocus=False)
await cmd.apply(ui)
ui.notify.assert_not_called()
@utilities.async_test
async def test_no_spawn_stdin_success(self):
ui = utilities.make_ui()
- cmd = g_commands.ExternalCommand(u"awk '{ exit $0 }'", stdin=u'0',
+ cmd = g_commands.ExternalCommand("awk '{ exit $0 }'", stdin='0',
refocus=False)
await cmd.apply(ui)
ui.notify.assert_not_called()
@@ -124,7 +124,7 @@ class TestExternalCommand(unittest.TestCase):
@utilities.async_test
async def test_no_spawn_no_stdin_attached(self):
ui = utilities.make_ui()
- cmd = g_commands.ExternalCommand(u'test -t 0', refocus=False)
+ cmd = g_commands.ExternalCommand('test -t 0', refocus=False)
await cmd.apply(ui)
ui.notify.assert_not_called()
@@ -132,7 +132,7 @@ class TestExternalCommand(unittest.TestCase):
async def test_no_spawn_stdin_attached(self):
ui = utilities.make_ui()
cmd = g_commands.ExternalCommand(
- u"test -t 0", stdin=u'0', refocus=False)
+ "test -t 0", stdin='0', refocus=False)
await cmd.apply(ui)
ui.notify.assert_called_once_with(
'editor has exited with error code 1 -- No stderr output',
@@ -141,7 +141,7 @@ class TestExternalCommand(unittest.TestCase):
@utilities.async_test
async def test_no_spawn_failure(self):
ui = utilities.make_ui()
- cmd = g_commands.ExternalCommand(u'false', refocus=False)
+ cmd = g_commands.ExternalCommand('false', refocus=False)
await cmd.apply(ui)
ui.notify.assert_called_once_with(
'editor has exited with error code 1 -- No stderr output',
@@ -153,7 +153,7 @@ class TestExternalCommand(unittest.TestCase):
@mock.patch.dict(os.environ, {'DISPLAY': ':0'})
async def test_spawn_no_stdin_success(self):
ui = utilities.make_ui()
- cmd = g_commands.ExternalCommand(u'true', refocus=False, spawn=True)
+ cmd = g_commands.ExternalCommand('true', refocus=False, spawn=True)
await cmd.apply(ui)
ui.notify.assert_not_called()
@@ -164,8 +164,8 @@ class TestExternalCommand(unittest.TestCase):
async def test_spawn_stdin_success(self):
ui = utilities.make_ui()
cmd = g_commands.ExternalCommand(
- u"awk '{ exit $0 }'",
- stdin=u'0', refocus=False, spawn=True)
+ "awk '{ exit $0 }'",
+ stdin='0', refocus=False, spawn=True)
await cmd.apply(ui)
ui.notify.assert_not_called()
@@ -175,7 +175,7 @@ class TestExternalCommand(unittest.TestCase):
@mock.patch.dict(os.environ, {'DISPLAY': ':0'})
async def test_spawn_failure(self):
ui = utilities.make_ui()
- cmd = g_commands.ExternalCommand(u'false', refocus=False, spawn=True)
+ cmd = g_commands.ExternalCommand('false', refocus=False, spawn=True)
await cmd.apply(ui)
ui.notify.assert_called_once_with(
'editor has exited with error code 1 -- No stderr output',
diff --git a/tests/commands/test_init.py b/tests/commands/test_init.py
index 29828b9a..f7574977 100644
--- a/tests/commands/test_init.py
+++ b/tests/commands/test_init.py
@@ -33,7 +33,7 @@ class TestCommandFactory(unittest.TestCase):
cmd = commands.commandfactory('save --all /foo', mode='thread')
self.assertIsInstance(cmd, thread.SaveAttachmentCommand)
self.assertTrue(cmd.all)
- self.assertEqual(cmd.path, u'/foo')
+ self.assertEqual(cmd.path, '/foo')
class TestRegisterCommand(unittest.TestCase):
diff --git a/tests/commands/test_thread.py b/tests/commands/test_thread.py
index 335ca388..5d25079d 100644
--- a/tests/commands/test_thread.py
+++ b/tests/commands/test_thread.py
@@ -77,77 +77,77 @@ class TestDetermineSender(unittest.TestCase):
self.assertTupleEqual(cm2.exception.args, expected)
def test_default_account_is_used_if_no_match_is_found(self):
- account1 = _AccountTestClass(address=u'foo@example.com')
- account2 = _AccountTestClass(address=u'bar@example.com')
- expected = (u'foo@example.com', account1)
+ account1 = _AccountTestClass(address='foo@example.com')
+ account2 = _AccountTestClass(address='bar@example.com')
+ expected = ('foo@example.com', account1)
self._test(accounts=[account1, account2], expected=expected)
def test_matching_address_and_account_are_returned(self):
- account1 = _AccountTestClass(address=u'foo@example.com')
- account2 = _AccountTestClass(address=u'to@example.com')
- account3 = _AccountTestClass(address=u'bar@example.com')
- expected = (u'to@example.com', account2)
+ account1 = _AccountTestClass(address='foo@example.com')
+ account2 = _AccountTestClass(address='to@example.com')
+ account3 = _AccountTestClass(address='bar@example.com')
+ expected = ('to@example.com', account2)
self._test(accounts=[account1, account2, account3], expected=expected)
def test_force_realname_has_real_name_in_returned_address_if_defined(self):
- account1 = _AccountTestClass(address=u'foo@example.com')
- account2 = _AccountTestClass(address=u'to@example.com', realname='Bar')
- account3 = _AccountTestClass(address=u'baz@example.com')
- expected = (u'Bar <to@example.com>', account2)
+ account1 = _AccountTestClass(address='foo@example.com')
+ account2 = _AccountTestClass(address='to@example.com', realname='Bar')
+ account3 = _AccountTestClass(address='baz@example.com')
+ expected = ('Bar <to@example.com>', account2)
self._test(accounts=[account1, account2, account3], expected=expected,
force_realname=True)
def test_doesnt_fail_with_force_realname_if_real_name_not_defined(self):
- account1 = _AccountTestClass(address=u'foo@example.com')
- account2 = _AccountTestClass(address=u'to@example.com')
- account3 = _AccountTestClass(address=u'bar@example.com')
- expected = (u'to@example.com', account2)
+ account1 = _AccountTestClass(address='foo@example.com')
+ account2 = _AccountTestClass(address='to@example.com')
+ account3 = _AccountTestClass(address='bar@example.com')
+ expected = ('to@example.com', account2)
self._test(accounts=[account1, account2, account3], expected=expected,
force_realname=True)
def test_with_force_address_main_address_is_always_used(self):
# In python 3.4 this and the next test could be written as subtests.
- account1 = _AccountTestClass(address=u'foo@example.com')
- account2 = _AccountTestClass(address=u'bar@example.com',
- aliases=[u'to@example.com'])
- account3 = _AccountTestClass(address=u'bar@example.com')
- expected = (u'bar@example.com', account2)
+ account1 = _AccountTestClass(address='foo@example.com')
+ account2 = _AccountTestClass(address='bar@example.com',
+ aliases=['to@example.com'])
+ account3 = _AccountTestClass(address='bar@example.com')
+ expected = ('bar@example.com', account2)
self._test(accounts=[account1, account2, account3], expected=expected,
force_address=True)
def test_without_force_address_matching_address_is_used(self):
# In python 3.4 this and the previous test could be written as
# subtests.
- account1 = _AccountTestClass(address=u'foo@example.com')
- account2 = _AccountTestClass(address=u'bar@example.com',
- aliases=[u'to@example.com'])
- account3 = _AccountTestClass(address=u'baz@example.com')
- expected = (u'to@example.com', account2)
+ account1 = _AccountTestClass(address='foo@example.com')
+ account2 = _AccountTestClass(address='bar@example.com',
+ aliases=['to@example.com'])
+ account3 = _AccountTestClass(address='baz@example.com')
+ expected = ('to@example.com', account2)
self._test(accounts=[account1, account2, account3], expected=expected,
force_address=False)
def test_uses_to_header_if_present(self):
- account1 = _AccountTestClass(address=u'foo@example.com')
- account2 = _AccountTestClass(address=u'to@example.com')
- account3 = _AccountTestClass(address=u'bar@example.com')
- expected = (u'to@example.com', account2)
+ account1 = _AccountTestClass(address='foo@example.com')
+ account2 = _AccountTestClass(address='to@example.com')
+ account3 = _AccountTestClass(address='bar@example.com')
+ expected = ('to@example.com', account2)
self._test(accounts=[account1, account2, account3], expected=expected)
def test_header_order_is_more_important_than_accounts_order(self):
- account1 = _AccountTestClass(address=u'cc@example.com')
- account2 = _AccountTestClass(address=u'to@example.com')
- account3 = _AccountTestClass(address=u'bcc@example.com')
- expected = (u'to@example.com', account2)
+ account1 = _AccountTestClass(address='cc@example.com')
+ account2 = _AccountTestClass(address='to@example.com')
+ account3 = _AccountTestClass(address='bcc@example.com')
+ expected = ('to@example.com', account2)
self._test(accounts=[account1, account2, account3], expected=expected)
def test_accounts_can_be_found_by_alias_regex_setting(self):
- account1 = _AccountTestClass(address=u'foo@example.com')
- account2 = _AccountTestClass(address=u'to@example.com',
+ account1 = _AccountTestClass(address='foo@example.com')
+ account2 = _AccountTestClass(address='to@example.com',
alias_regexp=r'to\+.*@example.com')
- account3 = _AccountTestClass(address=u'bar@example.com')
- mailstring = self.mailstring.replace(u'to@example.com',
- u'to+some_tag@example.com')
+ account3 = _AccountTestClass(address='bar@example.com')
+ mailstring = self.mailstring.replace('to@example.com',
+ 'to+some_tag@example.com')
mail = email.message_from_string(mailstring)
- expected = (u'to+some_tag@example.com', account2)
+ expected = ('to+some_tag@example.com', account2)
self._test(accounts=[account1, account2, account3], expected=expected,
mail=mail)