Skip to content

Commit 93b10d5

Browse files
Don't need __model__ declaration in builder classes.
1 parent f441269 commit 93b10d5

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

tests/utils/builders.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,18 @@
77
from eligibility_signposting_api.model.rules import CampaignConfig, Iteration, IterationCohort, IterationRule
88

99

10-
class IterationCohortFactory(ModelFactory[IterationCohort]):
11-
__model__ = IterationCohort
10+
class IterationCohortFactory(ModelFactory[IterationCohort]): ...
1211

1312

14-
class IterationRuleFactory(ModelFactory[IterationRule]):
15-
__model__ = IterationRule
13+
class IterationRuleFactory(ModelFactory[IterationRule]): ...
1614

1715

1816
class IterationFactory(ModelFactory[Iteration]):
19-
__model__ = Iteration
2017
iteration_cohorts = Use(IterationCohortFactory.batch, size=2)
2118
iteration_rules = Use(IterationRuleFactory.batch, size=2)
2219

2320

2421
class CampaignConfigFactory(ModelFactory[CampaignConfig]):
25-
__model__ = CampaignConfig
2622
iterations = Use(IterationFactory.batch, size=2)
2723

2824

tests/utils/matchers/meta.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,8 @@ def is_eligibility_status() -> Matcher[EligibilityStatus]: return EligibilitySta
6060

6161
__domain_class__ = None # Will be inferred when subclassed generically
6262

63-
def __init__(self):
64-
super().__init__()
65-
6663
def describe_to(self, description: Description) -> None:
67-
description.append_text(f"{self.__class__.__name__.removesuffix('Matcher')} with")
64+
description.append_text(f"{self.__domain_class__.__name__} with")
6865
for field_name in self.__domain_class__.__annotations__:
6966
attr_name = f"{field_name}_" if field_name in {"id", "type"} else field_name
7067
self.append_matcher_description(getattr(self, attr_name), field_name, description)

0 commit comments

Comments
 (0)