Skip to content

Commit

Permalink
lint quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
Rômulo Collopy committed Jul 23, 2023
1 parent f9b7aa9 commit a6b7bc0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pydantic/_internal/_model_construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def __new__(
base_field_names, class_vars, base_private_attributes = mcs._collect_bases_data(bases)

config_wrapper = ConfigWrapper.for_model(bases, namespace, kwargs)
cls_name = config_wrapper.config_dict.get("model_name") or cls_name
cls_name = config_wrapper.config_dict.get('model_name') or cls_name
namespace['model_config'] = config_wrapper.config_dict
private_attributes = inspect_namespace(
namespace, config_wrapper.ignored_types, class_vars, base_field_names
Expand Down
2 changes: 1 addition & 1 deletion pydantic/v1/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
default_prefix = '#/definitions/'
default_ref_template = '#/definitions/{model}'

T = TypeVar("T", bound="BaseModel")
T = TypeVar('T', bound='BaseModel')
TypeModelOrEnum = Union[Type[T], Type[Enum]]
TypeModelSet = Set[TypeModelOrEnum]

Expand Down
18 changes: 9 additions & 9 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,8 @@ def my_function():
pass

def test_config_model_name() -> None:
CLIENT_USER_MODEL_NAME = "ClientUser"
BUSINESS_USER_MODEL_NAME = "BusinessUser"
CLIENT_USER_MODEL_NAME = 'ClientUser'
BUSINESS_USER_MODEL_NAME = 'BusinessUser'


def _get_business_user_class():
Expand All @@ -509,11 +509,11 @@ class User(BaseModel):
assert name_map[BusinessUser] == BUSINESS_USER_MODEL_NAME
assert name_map[ClientUser] == CLIENT_USER_MODEL_NAME

assert BusinessUser().model_json_schema()["title"] == BUSINESS_USER_MODEL_NAME
assert ClientUser().model_json_schema()["title"] == CLIENT_USER_MODEL_NAME
assert BusinessUser().model_json_schema()['title'] == BUSINESS_USER_MODEL_NAME
assert ClientUser().model_json_schema()['title'] == CLIENT_USER_MODEL_NAME

def test_config_model_name__long_model_name_on_conflict() -> None:
CLIENT_USER_MODEL_NAME = "ClientUser"
CLIENT_USER_MODEL_NAME = 'ClientUser'


def _get_client_user_class():
Expand All @@ -533,12 +533,12 @@ class User(BaseModel):
ClientUserV2 = _get_client_2_user_class()

name_map = get_model_name_map({ClientUser, ClientUserV2})
assert name_map[ClientUser] == "tests__test_config__test_config_model_name__long_model_name_on_conflict__<locals>___get_client_user_class__<locals>__User"
assert name_map[ClientUserV2] == "tests__test_config__test_config_model_name__long_model_name_on_conflict__<locals>___get_client_2_user_class__<locals>__User"
assert name_map[ClientUser] == 'tests__test_config__test_config_model_name__long_model_name_on_conflict__<locals>___get_client_user_class__<locals>__User'
assert name_map[ClientUserV2] == 'tests__test_config__test_config_model_name__long_model_name_on_conflict__<locals>___get_client_2_user_class__<locals>__User'

#FIXME: Maye the model_json_schema should have a long name on conflict?
assert ClientUser().model_json_schema()["title"] == CLIENT_USER_MODEL_NAME
assert ClientUserV2().model_json_schema()["title"] == CLIENT_USER_MODEL_NAME
assert ClientUser().model_json_schema()['title'] == CLIENT_USER_MODEL_NAME
assert ClientUserV2().model_json_schema()['title'] == CLIENT_USER_MODEL_NAME


def test_multiple_inheritance_config():
Expand Down

0 comments on commit a6b7bc0

Please sign in to comment.