From 2212bab26df1517f24920d27977ae882e9089f8e Mon Sep 17 00:00:00 2001 From: lei_ju Date: Tue, 22 Dec 2020 20:01:20 +0800 Subject: [PATCH] fix test syntax error diff --git a/src/mailman/commands/tests/test_cli_addmembers.py b/src/mailman/commands/tests/test_cli_addmembers.py index 37e3864..9cbb564 100644 --- a/src/mailman/commands/tests/test_cli_addmembers.py +++ b/src/mailman/commands/tests/test_cli_addmembers.py @@ -45,7 +45,7 @@ class TestCLIAddMembers(unittest.TestCase): self.assertEqual( result.output, 'Usage: addmembers [OPTIONS] FILENAME LISTSPEC\n' - 'Try \'addmembers --help\' for help.\n\n' + 'Try "addmembers --help" for help.\n\n' 'Error: No such list: bee.example.com\n') def test_bad_filename(self): @@ -54,8 +54,8 @@ class TestCLIAddMembers(unittest.TestCase): self.assertEqual( result.output, 'Usage: addmembers [OPTIONS] FILENAME LISTSPEC\n' - 'Try \'addmembers --help\' for help.\n\n' - 'Error: Invalid value for \'FILENAME\': Could not open ' + 'Try "addmembers --help" for help.\n\n' + 'Error: Invalid value for "FILENAME": Could not open ' 'file: bad: No such file or directory\n') def test_already_subscribed_with_display_name(self): @@ -243,8 +243,8 @@ class TestCLIAddMembers(unittest.TestCase): self.assertEqual( result.output, 'Usage: addmembers [OPTIONS] FILENAME LISTSPEC\n' - 'Try \'addmembers --help\' for help.\n\n' - 'Error: Invalid value for \'--delivery\' / \'-d\': ' + 'Try "addmembers --help" for help.\n\n' + 'Error: Invalid value for "--delivery" / "-d": ' 'invalid choice: bogus. (choose from regular, mime, ' 'plain, summary, disabled)\n') diff --git a/src/mailman/commands/tests/test_cli_conf.py b/src/mailman/commands/tests/test_cli_conf.py index 2aeed0c..0c21548 100644 --- a/src/mailman/commands/tests/test_cli_conf.py +++ b/src/mailman/commands/tests/test_cli_conf.py @@ -40,7 +40,7 @@ class TestConf(unittest.TestCase): self.assertEqual( result.output, 'Usage: conf [OPTIONS]\n' - 'Try \'conf --help\' for help.\n\n' + 'Try "conf --help" for help.\n\n' 'Error: No such section: thissectiondoesnotexist\n') def test_cannot_access_nonexistent_section_and_key(self): @@ -50,7 +50,7 @@ class TestConf(unittest.TestCase): self.assertEqual( result.output, 'Usage: conf [OPTIONS]\n' - 'Try \'conf --help\' for help.\n\n' + 'Try "conf --help" for help.\n\n' 'Error: No such section: thissectiondoesnotexist\n') def test_cannot_access_nonexistent_key(self): @@ -60,7 +60,7 @@ class TestConf(unittest.TestCase): self.assertEqual( result.output, 'Usage: conf [OPTIONS]\n' - 'Try \'conf --help\' for help.\n\n' + 'Try "conf --help" for help.\n\n' 'Error: Section mailman: No such key: thiskeydoesnotexist\n') def test_pushed_section_is_found(self): diff --git a/src/mailman/commands/tests/test_cli_control.py b/src/mailman/commands/tests/test_cli_control.py index 6222fb8..96948c7 100644 --- a/src/mailman/commands/tests/test_cli_control.py +++ b/src/mailman/commands/tests/test_cli_control.py @@ -254,7 +254,7 @@ class TestControl(unittest.TestCase): self.assertEqual( result.output, 'Usage: start [OPTIONS]\n' - 'Try \'start --help\' for help.\n\n' + 'Try "start --help" for help.\n\n' 'Error: A previous run of GNU Mailman did not exit cleanly ' '(stale_lock). Try using --force\n') @@ -304,7 +304,7 @@ class TestControlSimple(unittest.TestCase): self.assertEqual( results.output, 'Usage: start [OPTIONS]\n' - 'Try \'start --help\' for help.\n\n' + 'Try "start --help" for help.\n\n' 'Error: GNU Mailman is already running\n') def test_reopen(self): diff --git a/src/mailman/commands/tests/test_cli_create.py b/src/mailman/commands/tests/test_cli_create.py index b501976..6a3ab9b 100644 --- a/src/mailman/commands/tests/test_cli_create.py +++ b/src/mailman/commands/tests/test_cli_create.py @@ -41,7 +41,7 @@ class TestCreate(unittest.TestCase): self.assertEqual( result.output, 'Usage: create [OPTIONS] LISTNAME\n' - 'Try \'create --help\' for help.\n\n' + 'Try "create --help" for help.\n\n' 'Error: List already exists: ant@example.com\n') def test_invalid_posting_address(self): @@ -51,7 +51,7 @@ class TestCreate(unittest.TestCase): self.assertEqual( result.output, 'Usage: create [OPTIONS] LISTNAME\n' - 'Try \'create --help\' for help.\n\n' + 'Try "create --help" for help.\n\n' 'Error: Illegal list name: foo\n') def test_invalid_owner_addresses(self): @@ -62,7 +62,7 @@ class TestCreate(unittest.TestCase): self.assertEqual( result.output, 'Usage: create [OPTIONS] LISTNAME\n' - 'Try \'create --help\' for help.\n\n' + 'Try "create --help" for help.\n\n' 'Error: Illegal owner addresses: invalid\n') def test_create_without_domain_option(self): @@ -92,7 +92,7 @@ class TestCreate(unittest.TestCase): self.assertEqual( result.output, 'Usage: create [OPTIONS] LISTNAME\n' - 'Try \'create --help\' for help.\n\n' + 'Try "create --help" for help.\n\n' 'Error: Undefined domain: example.org\n') def test_create_with_nodomain(self): @@ -102,7 +102,7 @@ class TestCreate(unittest.TestCase): self.assertEqual( result.output, 'Usage: create [OPTIONS] LISTNAME\n' - 'Try \'create --help\' for help.\n\n' + 'Try "create --help" for help.\n\n' 'Error: Undefined domain: example.org\n') diff --git a/src/mailman/commands/tests/test_cli_delmembers.py b/src/mailman/commands/tests/test_cli_delmembers.py index e038e36..d5b6663 100644 --- a/src/mailman/commands/tests/test_cli_delmembers.py +++ b/src/mailman/commands/tests/test_cli_delmembers.py @@ -45,7 +45,7 @@ class TestCLIDelMembers(unittest.TestCase): self.assertEqual( result.output, 'Usage: delmembers [OPTIONS]\n' - 'Try \'delmembers --help\' for help.\n\n' + 'Try "delmembers --help" for help.\n\n' 'Error: No such list: bee.example.com\n') def test_bad_filename(self): @@ -55,8 +55,8 @@ class TestCLIDelMembers(unittest.TestCase): self.assertEqual( result.output, 'Usage: delmembers [OPTIONS]\n' - 'Try \'delmembers --help\' for help.\n\n' - 'Error: Invalid value for \'--file\' / \'-f\': Could not open ' + 'Try "delmembers --help" for help.\n\n' + 'Error: Invalid value for "--file" / "-f": Could not open ' 'file: bad: No such file or directory\n') def test_not_subscribed_without_display_name(self): @@ -212,7 +212,7 @@ class TestCLIDelMembers(unittest.TestCase): self.assertEqual( result.output, 'Usage: delmembers [OPTIONS]\n' - 'Try \'delmembers --help\' for help.\n\n' + 'Try "delmembers --help" for help.\n\n' 'Error: --fromall may not be specified with -l/--list, ' 'or -a/--all\n') @@ -223,7 +223,7 @@ class TestCLIDelMembers(unittest.TestCase): self.assertEqual( result.output, 'Usage: delmembers [OPTIONS]\n' - 'Try \'delmembers --help\' for help.\n\n' + 'Try "delmembers --help" for help.\n\n' 'Error: --fromall may not be specified with -l/--list, ' 'or -a/--all\n') @@ -234,7 +234,7 @@ class TestCLIDelMembers(unittest.TestCase): self.assertEqual( result.output, 'Usage: delmembers [OPTIONS]\n' - 'Try \'delmembers --help\' for help.\n\n' + 'Try "delmembers --help" for help.\n\n' 'Error: -a/--all must not be specified with ' '-f/--file or -m/--member.\n') @@ -245,7 +245,7 @@ class TestCLIDelMembers(unittest.TestCase): self.assertEqual( result.output, 'Usage: delmembers [OPTIONS]\n' - 'Try \'delmembers --help\' for help.\n\n' + 'Try "delmembers --help" for help.\n\n' 'Error: -a/--all must not be specified with ' '-f/--file or -m/--member.\n') @@ -256,7 +256,7 @@ class TestCLIDelMembers(unittest.TestCase): self.assertEqual( result.output, 'Usage: delmembers [OPTIONS]\n' - 'Try \'delmembers --help\' for help.\n\n' + 'Try "delmembers --help" for help.\n\n' 'Error: Without --fromall, -l/--list is required.\n') def test_invalid_no_all_file_or_member(self): @@ -266,7 +266,7 @@ class TestCLIDelMembers(unittest.TestCase): self.assertEqual( result.output, 'Usage: delmembers [OPTIONS]\n' - 'Try \'delmembers --help\' for help.\n\n' + 'Try "delmembers --help" for help.\n\n' 'Error: At least one of -a/--all, -f/--file or -m/--member ' 'is required.\n') diff --git a/src/mailman/commands/tests/test_cli_import.py b/src/mailman/commands/tests/test_cli_import.py index 3080691..4bb8602 100644 --- a/src/mailman/commands/tests/test_cli_import.py +++ b/src/mailman/commands/tests/test_cli_import.py @@ -58,8 +58,8 @@ class TestImport(unittest.TestCase): self.assertEqual( result.output, 'Usage: import21 [OPTIONS] LISTSPEC PICKLE_FILE\n' - 'Try \'import21 --help\' for help.\n\n' - 'Error: Missing argument \'LISTSPEC\'.\n') + 'Try "import21 --help" for help.\n\n' + 'Error: Missing argument "LISTSPEC".\n') def test_pickle_with_nondict(self): with NamedTemporaryFile() as pckfile: diff --git a/src/mailman/commands/tests/test_cli_inject.py b/src/mailman/commands/tests/test_cli_inject.py index 637080b..2dec6ed 100644 --- a/src/mailman/commands/tests/test_cli_inject.py +++ b/src/mailman/commands/tests/test_cli_inject.py @@ -63,7 +63,7 @@ class TestInject(unittest.TestCase): self.assertEqual( result.output, 'Usage: inject [OPTIONS] LISTSPEC\n' - 'Try \'inject --help\' for help.\n\n' + 'Try "inject --help" for help.\n\n' 'Error: No such list: bee.example.com\n') def test_inject_no_such_queue(self): @@ -73,7 +73,7 @@ class TestInject(unittest.TestCase): self.assertEqual( result.output, 'Usage: inject [OPTIONS] LISTSPEC\n' - 'Try \'inject --help\' for help.\n\n' + 'Try "inject --help" for help.\n\n' 'Error: No such queue: bogus\n') def test_inject_no_filename_option(self): diff --git a/src/mailman/commands/tests/test_cli_members.py b/src/mailman/commands/tests/test_cli_members.py index 18301f4..7eb5371 100644 --- a/src/mailman/commands/tests/test_cli_members.py +++ b/src/mailman/commands/tests/test_cli_members.py @@ -41,7 +41,7 @@ class TestCLIMembers(unittest.TestCase): self.assertEqual( result.output, 'Usage: members [OPTIONS] LISTSPEC\n' - 'Try \'members --help\' for help.\n\n' + 'Try "members --help" for help.\n\n' 'Error: No such list: bee.example.com\n') def test_role_administrator(self): diff --git a/src/mailman/commands/tests/test_cli_shell.py b/src/mailman/commands/tests/test_cli_shell.py index 3d2dd39..03f6509 100644 --- a/src/mailman/commands/tests/test_cli_shell.py +++ b/src/mailman/commands/tests/test_cli_shell.py @@ -142,7 +142,7 @@ Exit with ctrl+D does an implicit commit() but exit() does not.\n""") self.assertEqual( results.output, 'Usage: shell [OPTIONS] [RUN_ARGS]...\n' - 'Try \'shell --help\' for help.\n\n' + 'Try "shell --help" for help.\n\n' 'Error: Regular expression requires --run\n') def test_listspec_without_run(self): @@ -165,7 +165,7 @@ Exit with ctrl+D does an implicit commit() but exit() does not.\n""") self.assertEqual( results.output, 'Usage: shell [OPTIONS] [RUN_ARGS]...\n' - 'Try \'shell --help\' for help.\n\n' + 'Try "shell --help" for help.\n\n' 'Error: No such list: ant.example.com\n') def test_run_without_listspec(self): @@ -183,5 +183,5 @@ Exit with ctrl+D does an implicit commit() but exit() does not.\n""") self.assertEqual( results.output, 'Usage: shell [OPTIONS] [RUN_ARGS]...\n' - 'Try \'shell --help\' for help.\n\n' + 'Try "shell --help" for help.\n\n' 'Error: No such list: bee.example.com\n') diff --git a/src/mailman/commands/tests/test_cli_syncmembers.py b/src/mailman/commands/tests/test_cli_syncmembers.py index e0d9caa..cf78cc5 100644 --- a/src/mailman/commands/tests/test_cli_syncmembers.py +++ b/src/mailman/commands/tests/test_cli_syncmembers.py @@ -48,7 +48,7 @@ class TestCLISyncMembers(unittest.TestCase): self.assertEqual( result.output, 'Usage: syncmembers [OPTIONS] FILENAME LISTSPEC\n' - 'Try \'syncmembers --help\' for help.\n\n' + 'Try "syncmembers --help" for help.\n\n' 'Error: No such list: bee.example.com\n') def test_bad_filename(self): @@ -57,8 +57,8 @@ class TestCLISyncMembers(unittest.TestCase): self.assertEqual( result.output, 'Usage: syncmembers [OPTIONS] FILENAME LISTSPEC\n' - 'Try \'syncmembers --help\' for help.\n\n' - 'Error: Invalid value for \'FILENAME\': Could not open ' + 'Try "syncmembers --help" for help.\n\n' + 'Error: Invalid value for "FILENAME": Could not open ' 'file: bad: No such file or directory\n') def test_sync_invalid_email(self): @@ -372,8 +372,8 @@ class TestCLISyncMembers(unittest.TestCase): self.assertEqual( result.output, 'Usage: syncmembers [OPTIONS] FILENAME LISTSPEC\n' - 'Try \'syncmembers --help\' for help.\n\n' - 'Error: Invalid value for \'--delivery\' / \'-d\': ' + 'Try "syncmembers --help" for help.\n\n' + 'Error: Invalid value for "--delivery" / "-d": ' 'invalid choice: bogus. (choose from regular, mime, ' 'plain, summary, disabled)\n') diff --git a/src/mailman/database/alembic/versions/33e1f5f6fa8_.py b/src/mailman/database/alembic/versions/33e1f5f6fa8_.py index 580e43c..e88c1b6 100644 --- a/src/mailman/database/alembic/versions/33e1f5f6fa8_.py +++ b/src/mailman/database/alembic/versions/33e1f5f6fa8_.py @@ -64,7 +64,7 @@ def downgrade(): # yet. op.execute( ('ALTER TABLE "{table}" ALTER COLUMN "{column}" ' - 'TYPE BYTEA USING decode("{column}", \'UTF8\')').format( + 'TYPE BYTEA USING decode("{column}", "UTF8")').format( table=table, column=column)) else: op.alter_column(table, column, type_=sa.LargeBinary) -- 2.23.0