-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into add-recursion-guard
- Loading branch information
Showing
2 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from typing import Any, Type | ||
|
||
from typing_extensions import TypeGuard | ||
|
||
from polyfactory.factories.base import BaseFactory, T | ||
|
||
|
||
def test_setting_set_as_default_factory_for_type_on_base_factory() -> None: | ||
"""Setting the value to `True` shouldn't raise exception when initializing.""" | ||
|
||
class CustomBaseFactory(BaseFactory[T]): | ||
__is_base_factory__ = True | ||
__set_as_default_factory_for_type__ = True | ||
|
||
@classmethod | ||
def is_supported_type(cls, value: Any) -> TypeGuard[Type[T]]: | ||
# Set this as false since this factory will be injected into the | ||
# list of base factories, but this obviously shouldn't be ran | ||
# for any of the types. | ||
return False |