From 95aeb4fdfa4b1a09c0da60328e1312ab3221e7d1 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Thu, 19 Aug 2021 18:41:53 +0100 Subject: [PATCH] Fix flake8 PT009 violation in tests (#1705) * Fix flake8 PT009 violation in tests Co-Authored-By: Sorin Sbarnea Co-authored-by: Sviatoslav Sydorenko --- .flake8 | 42 ++++++++++----------- test/TestBecomeUserWithoutBecome.py | 4 +- test/TestCliRolePaths.py | 32 ++++------------ test/TestCommandHasChangesCheck.py | 4 +- test/TestComparisonToLiteralBool.py | 10 ++--- test/TestDeprecatedModule.py | 2 +- test/TestEnvVarsInCommand.py | 4 +- test/TestLineTooLong.py | 2 +- test/TestLintRule.py | 4 +- test/TestMetaChangeFromDefault.py | 8 ++-- test/TestMetaMainHasInfo.py | 16 ++++---- test/TestMetaVideoLinks.py | 8 ++-- test/TestNoFormattingInWhenRule.py | 4 +- test/TestOctalPermissions.py | 14 +++---- test/TestPackageIsNotLatest.py | 4 +- test/TestRoleRelativePath.py | 4 +- test/TestShellWithoutPipefail.py | 4 +- test/TestTaskHasName.py | 4 +- test/TestTaskNoLocalAction.py | 2 +- test/TestUseHandlerRatherThanWhenChanged.py | 4 +- test/TestUsingBareVariablesIsDeprecated.py | 4 +- test/TestWithSkipTagId.py | 10 ++--- 22 files changed, 85 insertions(+), 105 deletions(-) diff --git a/.flake8 b/.flake8 index f465f36461..58c95e4039 100644 --- a/.flake8 +++ b/.flake8 @@ -61,42 +61,42 @@ per-file-ignores = test/rules/UnsetVariableMatcherRule.py: D100 D101 D102 test/TestAnsibleLintRule.py: D100 test/TestBaseFormatter.py: D100 - test/TestBecomeUserWithoutBecome.py: PT009 D100 D101 D102 - test/TestCliRolePaths.py: PT009 D100 D101 D102 + test/TestBecomeUserWithoutBecome.py: D100 D101 D102 + test/TestCliRolePaths.py: D100 D101 D102 test/TestCommandLineInvocationSameAsConfig.py: D100 - test/TestCommandHasChangesCheck.py: PT009 D100 D101 D102 - test/TestComparisonToLiteralBool.py: PT009 D100 D101 D102 + test/TestCommandHasChangesCheck.py: D100 D101 D102 + test/TestComparisonToLiteralBool.py: D100 D101 D102 test/TestDependenciesInMeta.py: D100 - test/TestDeprecatedModule.py: PT009 D100 D101 D102 - test/TestEnvVarsInCommand.py: PT009 D100 D101 D102 + test/TestDeprecatedModule.py: D100 D101 D102 + test/TestEnvVarsInCommand.py: D100 D101 D102 test/TestFormatter.py: D100 D101 D102 test/TestImportIncludeRole.py: D100 test/TestImportWithMalformed.py: D100 test/TestIncludeMissFileWithRole.py: D100 - test/TestLineTooLong.py: PT009 D100 D101 D102 - test/TestLintRule.py: PT009 D100 D101 D102 + test/TestLineTooLong.py: D100 D101 D102 + test/TestLintRule.py: D100 D101 D102 test/TestNestedJinjaRule.py: D100 test/TestMatchError.py: D101 - test/TestMetaChangeFromDefault.py: PT009 D100 D101 D102 - test/TestMetaMainHasInfo.py: PT009 D100 D101 D102 - test/TestMetaVideoLinks.py: PT009 D100 D101 D102 - test/TestNoFormattingInWhenRule.py: PT009 D100 D101 D102 - test/TestOctalPermissions.py: PT009 D100 D101 D102 - test/TestPackageIsNotLatest.py: PT009 D100 D101 D102 - test/TestRoleRelativePath.py: PT009 D100 D101 D102 + test/TestMetaChangeFromDefault.py: D100 D101 D102 + test/TestMetaMainHasInfo.py: D100 D101 D102 + test/TestMetaVideoLinks.py: D100 D101 D102 + test/TestNoFormattingInWhenRule.py: D100 D101 D102 + test/TestOctalPermissions.py: D100 D101 D102 + test/TestPackageIsNotLatest.py: D100 D101 D102 + test/TestRoleRelativePath.py: D100 D101 D102 test/TestRuleProperties.py: D100 test/TestRulesCollection.py: D100 test/TestRunner.py: D100 - test/TestShellWithoutPipefail.py: PT009 D100 D101 D102 + test/TestShellWithoutPipefail.py: D100 D101 D102 test/TestSkipImportPlaybook.py: D100 test/TestSkipInsideYaml.py: D100 test/TestSkipPlaybookItems.py: D100 - test/TestTaskHasName.py: PT009 D100 D101 D102 + test/TestTaskHasName.py: D100 D101 D102 test/TestTaskIncludes.py: D100 - test/TestTaskNoLocalAction.py: PT009 D100 D101 D102 - test/TestUseHandlerRatherThanWhenChanged.py: PT009 D100 D101 D102 - test/TestUsingBareVariablesIsDeprecated.py: PT009 D100 D101 D102 - test/TestWithSkipTagId.py: PT009 D100 D101 D102 + test/TestTaskNoLocalAction.py: D100 D101 D102 + test/TestUseHandlerRatherThanWhenChanged.py: D100 D101 D102 + test/TestUsingBareVariablesIsDeprecated.py: D100 D101 D102 + test/TestWithSkipTagId.py: D100 D101 D102 # flake8-pytest-style # PT001: diff --git a/test/TestBecomeUserWithoutBecome.py b/test/TestBecomeUserWithoutBecome.py index 51cdb18eb0..95bee78350 100644 --- a/test/TestBecomeUserWithoutBecome.py +++ b/test/TestBecomeUserWithoutBecome.py @@ -15,10 +15,10 @@ def setUp(self) -> None: def test_file_positive(self) -> None: success = 'examples/playbooks/become-user-without-become-success.yml' good_runner = Runner(success, rules=self.collection) - self.assertEqual([], good_runner.run()) + assert [] == good_runner.run() def test_file_negative(self) -> None: failure = 'examples/playbooks/become-user-without-become-failure.yml' bad_runner = Runner(failure, rules=self.collection) errs = bad_runner.run() - self.assertEqual(3, len(errs)) + assert len(errs) == 3 diff --git a/test/TestCliRolePaths.py b/test/TestCliRolePaths.py index b2666a8bed..1e6f292379 100644 --- a/test/TestCliRolePaths.py +++ b/test/TestCliRolePaths.py @@ -21,63 +21,49 @@ def test_run_single_role_path_no_trailing_slash_module(self) -> None: role_path = 'roles/test-role' result = run_ansible_lint(role_path, cwd=cwd) - self.assertIn( - 'Use shell only when shell functionality is required', result.stdout - ) + assert 'Use shell only when shell functionality is required' in result.stdout def test_run_single_role_path_no_trailing_slash_script(self) -> None: cwd = self.local_test_dir role_path = 'roles/test-role' result = run_ansible_lint(role_path, cwd=cwd, executable="ansible-lint") - self.assertIn( - 'Use shell only when shell functionality is required', result.stdout - ) + assert 'Use shell only when shell functionality is required' in result.stdout def test_run_single_role_path_with_trailing_slash(self) -> None: cwd = self.local_test_dir role_path = 'roles/test-role/' result = run_ansible_lint(role_path, cwd=cwd) - self.assertIn( - 'Use shell only when shell functionality is required', result.stdout - ) + assert 'Use shell only when shell functionality is required' in result.stdout def test_run_multiple_role_path_no_trailing_slash(self) -> None: cwd = self.local_test_dir role_path = 'roles/test-role' result = run_ansible_lint(role_path, cwd=cwd) - self.assertIn( - 'Use shell only when shell functionality is required', result.stdout - ) + assert 'Use shell only when shell functionality is required' in result.stdout def test_run_multiple_role_path_with_trailing_slash(self) -> None: cwd = self.local_test_dir role_path = 'roles/test-role/' result = run_ansible_lint(role_path, cwd=cwd) - self.assertIn( - 'Use shell only when shell functionality is required', result.stdout - ) + assert 'Use shell only when shell functionality is required' in result.stdout def test_run_inside_role_dir(self) -> None: cwd = os.path.join(self.local_test_dir, 'roles/test-role/') role_path = '.' result = run_ansible_lint(role_path, cwd=cwd) - self.assertIn( - 'Use shell only when shell functionality is required', result.stdout - ) + assert 'Use shell only when shell functionality is required' in result.stdout def test_run_role_three_dir_deep(self) -> None: cwd = self.local_test_dir role_path = 'testproject/roles/test-role' result = run_ansible_lint(role_path, cwd=cwd) - self.assertIn( - 'Use shell only when shell functionality is required', result.stdout - ) + assert 'Use shell only when shell functionality is required' in result.stdout def test_run_playbook(self) -> None: """Call ansible-lint the way molecule does.""" @@ -89,9 +75,7 @@ def test_run_playbook(self) -> None: env['ANSIBLE_ROLES_PATH'] = role_path result = run_ansible_lint(lintable, cwd=cwd, env=env) - self.assertIn( - 'Use shell only when shell functionality is required', result.stdout - ) + assert 'Use shell only when shell functionality is required' in result.stdout def test_run_role_name_invalid(self) -> None: cwd = self.local_test_dir diff --git a/test/TestCommandHasChangesCheck.py b/test/TestCommandHasChangesCheck.py index 13bb66155e..f4cccfa790 100644 --- a/test/TestCommandHasChangesCheck.py +++ b/test/TestCommandHasChangesCheck.py @@ -15,10 +15,10 @@ def setUp(self) -> None: def test_command_changes_positive(self) -> None: success = 'examples/playbooks/command-check-success.yml' good_runner = Runner(success, rules=self.collection) - self.assertEqual([], good_runner.run()) + assert [] == good_runner.run() def test_command_changes_negative(self) -> None: failure = 'examples/playbooks/command-check-failure.yml' bad_runner = Runner(failure, rules=self.collection) errs = bad_runner.run() - self.assertEqual(2, len(errs)) + assert len(errs) == 2 diff --git a/test/TestComparisonToLiteralBool.py b/test/TestComparisonToLiteralBool.py index 12b25c1327..f8cae4867a 100644 --- a/test/TestComparisonToLiteralBool.py +++ b/test/TestComparisonToLiteralBool.py @@ -63,20 +63,20 @@ def setUp(self) -> None: def test_when(self) -> None: results = self.runner.run_role_tasks_main(PASS_WHEN) - self.assertEqual(0, len(results)) + assert len(results) == 0 def test_when_not_false(self) -> None: results = self.runner.run_role_tasks_main(PASS_WHEN_NOT_FALSE) - self.assertEqual(0, len(results)) + assert len(results) == 0 def test_when_not_null(self) -> None: results = self.runner.run_role_tasks_main(PASS_WHEN_NOT_NULL) - self.assertEqual(0, len(results)) + assert len(results) == 0 def test_literal_true(self) -> None: results = self.runner.run_role_tasks_main(FAIL_LITERAL_TRUE) - self.assertEqual(1, len(results)) + assert len(results) == 1 def test_literal_false(self) -> None: results = self.runner.run_role_tasks_main(FAIL_LITERAL_FALSE) - assert len(results) == 2, results + assert len(results) == 2 diff --git a/test/TestDeprecatedModule.py b/test/TestDeprecatedModule.py index b7762552bc..e8f79c466c 100644 --- a/test/TestDeprecatedModule.py +++ b/test/TestDeprecatedModule.py @@ -21,7 +21,7 @@ def setUp(self) -> None: def test_module_deprecated(self) -> None: results = self.runner.run_role_tasks_main(MODULE_DEPRECATED) - self.assertEqual(1, len(results)) + assert len(results) == 1 # based on version and blend of ansible being used, we may # get a missing module, so we future proof the test assert ( diff --git a/test/TestEnvVarsInCommand.py b/test/TestEnvVarsInCommand.py index 9f8866968e..99782d952f 100644 --- a/test/TestEnvVarsInCommand.py +++ b/test/TestEnvVarsInCommand.py @@ -83,8 +83,8 @@ def setUp(self) -> None: def test_success(self) -> None: results = self.runner.run_playbook(SUCCESS_PLAY_TASKS) - self.assertEqual(0, len(results)) + assert len(results) == 0 def test_fail(self) -> None: results = self.runner.run_playbook(FAIL_PLAY_TASKS) - self.assertEqual(2, len(results)) + assert len(results) == 2 diff --git a/test/TestLineTooLong.py b/test/TestLineTooLong.py index b1f7dc08a0..44e2b378f3 100644 --- a/test/TestLineTooLong.py +++ b/test/TestLineTooLong.py @@ -21,4 +21,4 @@ def setUp(self) -> None: def test_long_line(self) -> None: results = self.runner.run_role_tasks_main(LONG_LINE) - self.assertEqual(1, len(results)) + assert len(results) == 1 diff --git a/test/TestLintRule.py b/test/TestLintRule.py index 8c263d087d..7889f5191c 100644 --- a/test/TestLintRule.py +++ b/test/TestLintRule.py @@ -31,10 +31,10 @@ def test_rule_matching(self) -> None: ematcher = EMatcherRule.EMatcherRule() lintable = Lintable('examples/playbooks/ematcher-rule.yml', kind="playbook") matches = ematcher.matchlines(lintable) - self.assertEqual(len(matches), 3) + assert len(matches) == 3 def test_rule_postmatching(self) -> None: rule = UnsetVariableMatcherRule.UnsetVariableMatcherRule() lintable = Lintable('examples/playbooks/bracketsmatchtest.yml', kind="playbook") matches = rule.matchlines(lintable) - self.assertEqual(len(matches), 2) + assert len(matches) == 2 diff --git a/test/TestMetaChangeFromDefault.py b/test/TestMetaChangeFromDefault.py index 1cff94e57a..b77ac818a5 100644 --- a/test/TestMetaChangeFromDefault.py +++ b/test/TestMetaChangeFromDefault.py @@ -23,7 +23,7 @@ def setUp(self) -> None: def test_default_galaxy_info(self) -> None: results = self.runner.run_role_meta_main(DEFAULT_GALAXY_INFO) - self.assertIn("Should change default metadata: author", str(results)) - self.assertIn("Should change default metadata: description", str(results)) - self.assertIn("Should change default metadata: company", str(results)) - self.assertIn("Should change default metadata: license", str(results)) + assert "Should change default metadata: author" in str(results) + assert "Should change default metadata: description" in str(results) + assert "Should change default metadata: company" in str(results) + assert "Should change default metadata: license" in str(results) diff --git a/test/TestMetaMainHasInfo.py b/test/TestMetaMainHasInfo.py index ffff58a0d2..984e551ff5 100644 --- a/test/TestMetaMainHasInfo.py +++ b/test/TestMetaMainHasInfo.py @@ -66,23 +66,23 @@ def setUp(self) -> None: def test_no_galaxy_info(self) -> None: results = self.runner.run_role_meta_main(NO_GALAXY_INFO) assert len(results) == 1 - self.assertIn("No 'galaxy_info' found", str(results)) + assert "No 'galaxy_info' found" in str(results) def test_missing_info(self) -> None: results = self.runner.run_role_meta_main(MISSING_INFO) assert len(results) == 3 - self.assertIn("Role info should contain author", str(results)) - self.assertIn("Role info should contain min_ansible_version", str(results)) - self.assertIn("Platform should contain name", str(results)) + assert "Role info should contain author" in str(results) + assert "Role info should contain min_ansible_version" in str(results) + assert "Platform should contain name" in str(results) def test_bad_types(self) -> None: results = self.runner.run_role_meta_main(BAD_TYPES) assert len(results) == 3 - self.assertIn("author should be a string", str(results)) - self.assertIn("description should be a string", str(results)) - self.assertIn("Platforms should be a list of dictionaries", str(results)) + assert "author should be a string" in str(results) + assert "description should be a string" in str(results) + assert "Platforms should be a list of dictionaries" in str(results) def test_platform_list_of_str(self) -> None: results = self.runner.run_role_meta_main(PLATFORMS_LIST_OF_STR) assert len(results) == 1 - self.assertIn("Platforms should be a list of dictionaries", str(results)) + assert "Platforms should be a list of dictionaries" in str(results) diff --git a/test/TestMetaVideoLinks.py b/test/TestMetaVideoLinks.py index 0270cd360d..109c79005b 100644 --- a/test/TestMetaVideoLinks.py +++ b/test/TestMetaVideoLinks.py @@ -27,8 +27,6 @@ def setUp(self) -> None: def test_video_links(self) -> None: results = self.runner.run_role_meta_main(META_VIDEO_LINKS) - self.assertIn("Expected item in 'video_links' to be a dictionary", str(results)) - self.assertIn( - "'video_links' to contain only keys 'url' and 'title'", str(results) - ) - self.assertIn("URL format 'www.myvid.com/vid' is not recognized", str(results)) + assert "Expected item in 'video_links' to be a dictionary" in str(results) + assert "'video_links' to contain only keys 'url' and 'title'" in str(results) + assert "URL format 'www.myvid.com/vid' is not recognized" in str(results) diff --git a/test/TestNoFormattingInWhenRule.py b/test/TestNoFormattingInWhenRule.py index 80c5a5f2e2..24fe92172e 100644 --- a/test/TestNoFormattingInWhenRule.py +++ b/test/TestNoFormattingInWhenRule.py @@ -15,10 +15,10 @@ def setUp(self) -> None: def test_file_positive(self) -> None: success = 'examples/playbooks/jinja2-when-success.yml' good_runner = Runner(success, rules=self.collection) - self.assertEqual([], good_runner.run()) + assert [] == good_runner.run() def test_file_negative(self) -> None: failure = 'examples/playbooks/jinja2-when-failure.yml' bad_runner = Runner(failure, rules=self.collection) errs = bad_runner.run() - self.assertEqual(2, len(errs)) + assert len(errs) == 2 diff --git a/test/TestOctalPermissions.py b/test/TestOctalPermissions.py index 81d3f7b262..3ec87fee12 100644 --- a/test/TestOctalPermissions.py +++ b/test/TestOctalPermissions.py @@ -136,22 +136,20 @@ def setUp(self) -> None: def test_success(self) -> None: results = self.runner.run_playbook(SUCCESS_TASKS) - self.assertEqual(0, len(results)) + assert len(results) == 0 def test_fail(self) -> None: results = self.runner.run_playbook(FAIL_TASKS) - self.assertEqual(4, len(results)) + assert len(results) == 4 def test_valid_modes(self) -> None: for mode in self.VALID_MODES: - self.assertFalse( - self.rule.is_invalid_permission(mode), - msg="0o%o should be a valid mode" % mode, + assert not self.rule.is_invalid_permission(mode), ( + "0o%o should be a valid mode" % mode ) def test_invalid_modes(self) -> None: for mode in self.INVALID_MODES: - self.assertTrue( - self.rule.is_invalid_permission(mode), - msg="%d should be an invalid mode" % mode, + assert self.rule.is_invalid_permission(mode), ( + "%d should be an invalid mode" % mode ) diff --git a/test/TestPackageIsNotLatest.py b/test/TestPackageIsNotLatest.py index 17ac009473..b21f38d0cb 100644 --- a/test/TestPackageIsNotLatest.py +++ b/test/TestPackageIsNotLatest.py @@ -15,10 +15,10 @@ def setUp(self) -> None: def test_package_not_latest_positive(self) -> None: success = 'examples/playbooks/package-check-success.yml' good_runner = Runner(success, rules=self.collection) - self.assertEqual([], good_runner.run()) + assert [] == good_runner.run() def test_package_not_latest_negative(self) -> None: failure = 'examples/playbooks/package-check-failure.yml' bad_runner = Runner(failure, rules=self.collection) errs = bad_runner.run() - self.assertEqual(4, len(errs)) + assert len(errs) == 4 diff --git a/test/TestRoleRelativePath.py b/test/TestRoleRelativePath.py index 4dc920d39e..627c8ed925 100644 --- a/test/TestRoleRelativePath.py +++ b/test/TestRoleRelativePath.py @@ -46,8 +46,8 @@ def setUp(self) -> None: def test_fail(self) -> None: results = self.runner.run_role_tasks_main(FAIL_TASKS) - self.assertEqual(2, len(results)) + assert len(results) == 2 def test_success(self) -> None: results = self.runner.run_role_tasks_main(SUCCESS_TASKS) - self.assertEqual(0, len(results)) + assert len(results) == 0 diff --git a/test/TestShellWithoutPipefail.py b/test/TestShellWithoutPipefail.py index 1f10b12e41..4b794b8c5e 100644 --- a/test/TestShellWithoutPipefail.py +++ b/test/TestShellWithoutPipefail.py @@ -87,8 +87,8 @@ def setUp(self) -> None: def test_fail(self) -> None: results = self.runner.run_playbook(FAIL_TASKS) - self.assertEqual(3, len(results)) + assert len(results) == 3 def test_success(self) -> None: results = self.runner.run_playbook(SUCCESS_TASKS) - self.assertEqual(0, len(results)) + assert len(results) == 0 diff --git a/test/TestTaskHasName.py b/test/TestTaskHasName.py index 1de8ef6d0e..6076c2f91d 100644 --- a/test/TestTaskHasName.py +++ b/test/TestTaskHasName.py @@ -15,10 +15,10 @@ def setUp(self) -> None: def test_file_positive(self) -> None: success = 'examples/playbooks/task-has-name-success.yml' good_runner = Runner(success, rules=self.collection) - self.assertEqual([], good_runner.run()) + assert [] == good_runner.run() def test_file_negative(self) -> None: failure = 'examples/playbooks/task-has-name-failure.yml' bad_runner = Runner(failure, rules=self.collection) errs = bad_runner.run() - self.assertEqual(4, len(errs)) + assert len(errs) == 4 diff --git a/test/TestTaskNoLocalAction.py b/test/TestTaskNoLocalAction.py index 13b697cbfa..cc8f42a901 100644 --- a/test/TestTaskNoLocalAction.py +++ b/test/TestTaskNoLocalAction.py @@ -21,4 +21,4 @@ def setUp(self) -> None: def test_local_action(self) -> None: results = self.runner.run_role_tasks_main(TASK_LOCAL_ACTION) - self.assertEqual(1, len(results)) + assert len(results) == 1 diff --git a/test/TestUseHandlerRatherThanWhenChanged.py b/test/TestUseHandlerRatherThanWhenChanged.py index 7ac6da1f14..cb8a086fcd 100644 --- a/test/TestUseHandlerRatherThanWhenChanged.py +++ b/test/TestUseHandlerRatherThanWhenChanged.py @@ -81,8 +81,8 @@ def setUp(self) -> None: def test_success(self) -> None: results = self.runner.run_role_tasks_main(SUCCESS_TASKS) - self.assertEqual(0, len(results)) + assert len(results) == 0 def test_fail(self) -> None: results = self.runner.run_role_tasks_main(FAIL_TASKS) - self.assertEqual(5, len(results)) + assert len(results) == 5 diff --git a/test/TestUsingBareVariablesIsDeprecated.py b/test/TestUsingBareVariablesIsDeprecated.py index 11b1467b49..35e6b46e71 100644 --- a/test/TestUsingBareVariablesIsDeprecated.py +++ b/test/TestUsingBareVariablesIsDeprecated.py @@ -17,10 +17,10 @@ def setUp(self) -> None: def test_file_positive(self) -> None: success = 'examples/playbooks/using-bare-variables-success.yml' good_runner = Runner(success, rules=self.collection) - self.assertEqual([], good_runner.run()) + assert [] == good_runner.run() def test_file_negative(self) -> None: failure = 'examples/playbooks/using-bare-variables-failure.yml' bad_runner = Runner(failure, rules=self.collection) errs = bad_runner.run() - self.assertEqual(11, len(errs)) + assert len(errs) == 11 diff --git a/test/TestWithSkipTagId.py b/test/TestWithSkipTagId.py index 3d82bc2edd..05c7ae56b4 100644 --- a/test/TestWithSkipTagId.py +++ b/test/TestWithSkipTagId.py @@ -14,13 +14,13 @@ class TestWithSkipTagId(unittest.TestCase): def test_negative_no_param(self) -> None: bad_runner = Runner(self.file, rules=self.collection) errs = bad_runner.run() - self.assertGreater(len(errs), 0) + assert len(errs) > 0 def test_negative_with_id(self) -> None: with_id = 'yaml' bad_runner = Runner(self.file, rules=self.collection, tags=frozenset([with_id])) errs = bad_runner.run() - self.assertGreater(len(errs), 0) + assert len(errs) > 0 def test_negative_with_tag(self) -> None: with_tag = 'trailing-spaces' @@ -28,14 +28,14 @@ def test_negative_with_tag(self) -> None: self.file, rules=self.collection, tags=frozenset([with_tag]) ) errs = bad_runner.run() - self.assertGreater(len(errs), 0) + assert len(errs) > 0 def test_positive_skip_id(self) -> None: skip_id = 'yaml' good_runner = Runner(self.file, rules=self.collection, skip_list=[skip_id]) - self.assertEqual([], good_runner.run()) + assert [] == good_runner.run() def test_positive_skip_tag(self) -> None: skip_tag = 'trailing-spaces' good_runner = Runner(self.file, rules=self.collection, skip_list=[skip_tag]) - self.assertEqual([], good_runner.run()) + assert [] == good_runner.run()