def test_override_prefetch_related_objects_as_decorator(self): self.assertIs(get_prefetch_related_objects(), mock_implementation)
def test_use_original_prefetch_related_objects(self): set_default_prefetch_related_objects(mock_implementation) with use_original_prefetch_related_objects(): self.assertIs(get_prefetch_related_objects(), original_prefetch_related_objects) self.assertIs(get_prefetch_related_objects(), mock_implementation)
def test_override_prefetch_related_objects(self): with override_prefetch_related_objects(mock_implementation): self.assertIs(get_prefetch_related_objects(), mock_implementation) self.assertIs(get_prefetch_related_objects(), original_prefetch_related_objects)
def test_get_prefetch_related_objects_with_default(self): set_default_prefetch_related_objects(mock_implementation) self.assertIs(get_prefetch_related_objects(), mock_implementation)
def test_get_prefetch_related_objects_returns_original_by_default(self): self.assertIs(get_prefetch_related_objects(), original_prefetch_related_objects)
def test_default_no_setting(self): self.config.set_default_prefetch_related_objects_implementation() self.assertIs(get_prefetch_related_objects(), original_prefetch_related_objects)
def test_default_from_object(self): self.config.set_default_prefetch_related_objects_implementation() self.assertIs(get_prefetch_related_objects(), identity_map_prefetch_related_objects)