Skip to content

Commit c3b1806

Browse files
committed
Use assertIn instead of assertTrue
1 parent a4d2112 commit c3b1806

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

AddonManagerTest/gui/test_installer_gui.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ def __init__(self):
225225
missing = MissingDependenciesMock()
226226
self.installer_gui.installer.allowed_packages = set(allowed_packages)
227227
self.installer_gui._clean_up_optional(missing)
228-
self.assertTrue("allowed_packages_1" in missing.python_optional)
229-
self.assertTrue("allowed_packages_2" in missing.python_optional)
230-
self.assertFalse("disallowed_package" in missing.python_optional)
228+
self.assertIn("allowed_packages_1", missing.python_optional)
229+
self.assertIn("allowed_packages_2", missing.python_optional)
230+
self.assertNotIn("disallowed_package", missing.python_optional)
231231

232232
def intercept_run_dependency_installer(self, addons, python_requires, python_optional):
233233
self.assertEqual(python_requires, ["py_req_1", "py_req_2"])
@@ -515,7 +515,7 @@ def test_install_toolbar_button_first_custom_toolbar(self):
515515
self.installer._install_toolbar_button()
516516
self.assertTrue(tbi.install_macro_to_toolbar_called)
517517
self.assertFalse(tbi.ask_for_toolbar_called)
518-
self.assertTrue("Custom_1" in self.installer.toolbar_params.GetGroups())
518+
self.assertIn("Custom_1", self.installer.toolbar_params.GetGroups())
519519

520520
def test_install_toolbar_button_existing_custom_toolbar_1(self):
521521
self.skipTest("Migration from toolbar_params is not reflected in the test yet")

AddonManagerTest/gui/test_python_deps_gui.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def test_call_pip(self, mock_run_subprocess: MagicMock):
5050
call_pip(["arg1", "arg2", "arg3"])
5151
mock_run_subprocess.assert_called()
5252
args = mock_run_subprocess.call_args[0][0]
53-
self.assertTrue("pip" in args)
53+
self.assertIn("pip", args)
5454

5555
@patch("addonmanager_python_deps_gui.utils.fci.get_python_exe")
5656
def test_call_pip_no_python(self, mock_get_python_exe: MagicMock):
@@ -107,8 +107,8 @@ def test_parse_pip_list_output_all_packages_no_updates(self):
107107
[],
108108
)
109109
self.assertEqual(len(results_dict), 2)
110-
self.assertTrue("gitdb" in results_dict)
111-
self.assertTrue("setuptools" in results_dict)
110+
self.assertIn("gitdb", results_dict)
111+
self.assertIn("setuptools", results_dict)
112112
self.assertEqual(results_dict["gitdb"]["installed_version"], "4.0.9")
113113
self.assertEqual(results_dict["gitdb"]["available_version"], "")
114114
self.assertEqual(results_dict["setuptools"]["installed_version"], "41.2.0")
@@ -125,8 +125,8 @@ def test_parse_pip_list_output_all_packages_with_updates(self):
125125
],
126126
)
127127
self.assertEqual(len(results_dict), 2)
128-
self.assertTrue("pip" in results_dict)
129-
self.assertTrue("setuptools" in results_dict)
128+
self.assertIn("pip", results_dict)
129+
self.assertIn("setuptools", results_dict)
130130
self.assertEqual(results_dict["pip"]["installed_version"], "21.0.1")
131131
self.assertEqual(results_dict["pip"]["available_version"], "22.1.2")
132132
self.assertEqual(results_dict["setuptools"]["installed_version"], "41.2.0")

0 commit comments

Comments
 (0)