Пример #1
0
 def __init__(
     self,
     created_date: int,
     client_data: Optional[dict] = None,
     conditions: Optional[List[Condition]] = None,
     bucketer: Optional[AbstractBucketer] = None,
 ) -> None:
     self.created_date = created_date
     self.client_data = client_data or {}
     self.conditions = conditions or []
     self.bucketer = bucketer or NoOpBucketer()
Пример #2
0
 def _has_bucketer(self) -> bool:
     return self._meta.bucketer.get_type() != NoOpBucketer.get_type()
Пример #3
0
 def test_is_correct_value(self):
     bucketer = NoOpBucketer()
     self.assertEqual("NoOpBucketer", bucketer.get_type())
Пример #4
0
 def test_sets_correct_data(self):
     data = {"type": NoOpBucketer.get_type()}
     bucketer = NoOpBucketer.from_dict(data)
     self.assertEqual(data, bucketer.to_dict())
Пример #5
0
 def test_returns_correct_data(self):
     bucketer = NoOpBucketer()
     expected = {"type": NoOpBucketer.get_type()}
     self.assertEqual(expected, bucketer.to_dict())
Пример #6
0
 def test_always_returns_true_with_checks(self):
     bucketer = NoOpBucketer()
     self.assertTrue(bucketer.check(foo=1))
Пример #7
0
 def test_creates_noop_bucketer(self):
     bucketer = BucketerFactory.create({"type": NoOpBucketer.get_type()})
     self.assertIsInstance(bucketer, NoOpBucketer)