Tests: modern PEP8-ify core test modules and methods (#2298)

* rename modules

* rename methods

* add docstrings to the general tests

* add base import stub

* test_base -> bases

* print deprecation warning

* redo 2346
This commit is contained in:
Aaron Wagener
2023-10-22 06:00:27 -05:00
committed by GitHub
parent 6e6fa13e44
commit 30da81c390
22 changed files with 410 additions and 356 deletions

View File

@@ -19,11 +19,11 @@ class TestDocs(unittest.TestCase):
cls.client = app.test_client()
def testCorrectErrorEmptyRequest(self):
def test_correct_error_empty_request(self):
response = self.client.post("/api/generate")
self.assertIn("No options found. Expected file attachment or json weights.", response.text)
def testGenerationQueued(self):
def test_generation_queued(self):
options = {
"Tester1":
{

View File

@@ -11,7 +11,7 @@ class TestDocs(unittest.TestCase):
def setUpClass(cls) -> None:
cls.tutorials_data = WebHost.create_ordered_tutorials_file()
def testHasTutorial(self):
def test_has_tutorial(self):
games_with_tutorial = set(entry["gameTitle"] for entry in self.tutorials_data)
for game_name, world_type in AutoWorldRegister.world_types.items():
if not world_type.hidden:
@@ -27,7 +27,7 @@ class TestDocs(unittest.TestCase):
self.fail(f"{game_name} has no setup tutorial. "
f"Games with Tutorial: {games_with_tutorial}")
def testHasGameInfo(self):
def test_has_game_info(self):
for game_name, world_type in AutoWorldRegister.world_types.items():
if not world_type.hidden:
target_path = Utils.local_path("WebHostLib", "static", "generated", "docs", game_name)

View File

@@ -13,7 +13,7 @@ class TestFileGeneration(unittest.TestCase):
# should not create the folder *here*
cls.incorrect_path = os.path.join(os.path.split(os.path.dirname(__file__))[0], "WebHostLib")
def testOptions(self):
def test_options(self):
from WebHostLib.options import create as create_options_files
create_options_files()
target = os.path.join(self.correct_path, "static", "generated", "configs")
@@ -30,7 +30,7 @@ class TestFileGeneration(unittest.TestCase):
for value in roll_options({file.name: f.read()})[0].values():
self.assertTrue(value is True, f"Default Options for template {file.name} cannot be run.")
def testTutorial(self):
def test_tutorial(self):
WebHost.create_ordered_tutorials_file()
self.assertTrue(os.path.exists(os.path.join(self.correct_path, "static", "generated", "tutorials.json")))
self.assertFalse(os.path.exists(os.path.join(self.incorrect_path, "static", "generated", "tutorials.json")))