Skip to content

Commit fd121f0

Browse files
didier-durandholtskinner
authored andcommitted
test: applying review suggestion
1 parent c4a4864 commit fd121f0

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

tests/server/tasks/test_id_generator.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,32 +54,33 @@ def test_context_validation(self):
5454
with pytest.raises(ValidationError):
5555
IDGeneratorContext(task_id={'not': 'a string'})
5656

57-
class TestIDGenerator:
58-
"""Tests for IDGenerator abstract base class."""
5957

60-
def test_cannot_instantiate_abstract_class(self):
61-
"""Test that IDGenerator cannot be instantiated directly."""
62-
with pytest.raises(TypeError):
63-
IDGenerator()
58+
class TestIDGenerator:
59+
"""Tests for IDGenerator abstract base class."""
6460

65-
def test_subclass_must_implement_generate(self):
66-
"""Test that subclasses must implement the generate method."""
61+
def test_cannot_instantiate_abstract_class(self):
62+
"""Test that IDGenerator cannot be instantiated directly."""
63+
with pytest.raises(TypeError):
64+
IDGenerator()
6765

68-
class IncompleteGenerator(IDGenerator):
69-
pass
66+
def test_subclass_must_implement_generate(self):
67+
"""Test that subclasses must implement the generate method."""
7068

71-
with pytest.raises(TypeError):
72-
IncompleteGenerator()
69+
class IncompleteGenerator(IDGenerator):
70+
pass
7371

74-
def test_valid_subclass_implementation(self):
75-
"""Test that a valid subclass can be instantiated."""
72+
with pytest.raises(TypeError):
73+
IncompleteGenerator()
7674

77-
class ValidGenerator(IDGenerator): # pylint: disable=C0115,R0903
78-
def generate(self, context: IDGeneratorContext) -> str:
79-
return 'test_id'
75+
def test_valid_subclass_implementation(self):
76+
"""Test that a valid subclass can be instantiated."""
8077

81-
generator = ValidGenerator()
82-
assert generator.generate(IDGeneratorContext()) == 'test_id'
78+
class ValidGenerator(IDGenerator): # pylint: disable=C0115,R0903
79+
def generate(self, context: IDGeneratorContext) -> str:
80+
return 'test_id'
81+
82+
generator = ValidGenerator()
83+
assert generator.generate(IDGeneratorContext()) == 'test_id'
8384

8485

8586
@pytest.fixture

0 commit comments

Comments
 (0)