Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 19, 2021
1 parent f5f11a4 commit 9545c1b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 22 deletions.
4 changes: 3 additions & 1 deletion model_clone/mixins/clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ def check(cls, **kwargs):
"Conflicting configuration.",
hint=(
'Please provide either "_clone_o2o_fields"'
+ ' or "_clone_excluded_o2o_fields" for model {}'.format(cls.__name__)
+ ' or "_clone_excluded_o2o_fields" for model {}'.format(
cls.__name__
)
),
obj=cls,
id="{}.E002".format(ModelCloneConfig.name),
Expand Down
50 changes: 29 additions & 21 deletions model_clone/tests/test_clone_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,9 +635,11 @@ def test_cloning_complex_model_relationships(self):
"sample.models.Edition.UNIQUE_DUPLICATE_SUFFIX",
new_callable=PropertyMock,
)
def test_unique_duplicate_suffix_check(self, unique_duplicate_suffix_mock, use_unique_duplicate_suffix_mock):
def test_unique_duplicate_suffix_check(
self, unique_duplicate_suffix_mock, use_unique_duplicate_suffix_mock
):
use_unique_duplicate_suffix_mock.return_value = True
unique_duplicate_suffix_mock.return_value = ''
unique_duplicate_suffix_mock.return_value = ""

errors = Edition.check()
expected_errors = [
Expand All @@ -664,8 +666,8 @@ def test_unique_duplicate_suffix_check(self, unique_duplicate_suffix_mock, use_u
new_callable=PropertyMock,
)
def test_clone_fields_check(self, _clone_excluded_fields_mock, _clone_fields_mock):
_clone_excluded_fields_mock.return_value = ['test']
_clone_fields_mock.return_value = ['test']
_clone_excluded_fields_mock.return_value = ["test"]
_clone_fields_mock.return_value = ["test"]

errors = Edition.check()
expected_errors = [
Expand All @@ -674,8 +676,8 @@ def test_clone_fields_check(self, _clone_excluded_fields_mock, _clone_fields_moc
hint=(
'Please provide either "_clone_fields"'
+ ' or "_clone_excluded_fields" for model {}'.format(
Edition.__name__,
)
Edition.__name__,
)
),
obj=Edition,
id="{}.E002".format(ModelCloneConfig.name),
Expand All @@ -691,9 +693,11 @@ def test_clone_fields_check(self, _clone_excluded_fields_mock, _clone_fields_moc
"sample.models.Edition._clone_excluded_m2m_fields",
new_callable=PropertyMock,
)
def test_clone_m2m_fields_check(self, _clone_m2m_fields_mock, _clone_excluded_m2m_fields_mock):
_clone_m2m_fields_mock.return_value = ['test']
_clone_excluded_m2m_fields_mock.return_value = ['test']
def test_clone_m2m_fields_check(
self, _clone_m2m_fields_mock, _clone_excluded_m2m_fields_mock
):
_clone_m2m_fields_mock.return_value = ["test"]
_clone_excluded_m2m_fields_mock.return_value = ["test"]

errors = Edition.check()
expected_errors = [
Expand All @@ -702,8 +706,8 @@ def test_clone_m2m_fields_check(self, _clone_m2m_fields_mock, _clone_excluded_m2
hint=(
'Please provide either "_clone_m2m_fields"'
+ ' or "_clone_excluded_m2m_fields" for model {}'.format(
Edition.__name__,
)
Edition.__name__,
)
),
obj=Edition,
id="{}.E002".format(ModelCloneConfig.name),
Expand All @@ -719,9 +723,11 @@ def test_clone_m2m_fields_check(self, _clone_m2m_fields_mock, _clone_excluded_m2
"sample.models.Edition._clone_excluded_m2o_or_o2m_fields",
new_callable=PropertyMock,
)
def test_clone_m2o_or_o2m_fields_check(self, _clone_m2o_or_o2m_fields_mock, _clone_excluded_m2o_or_o2m_fields_mock):
_clone_m2o_or_o2m_fields_mock.return_value = ['test']
_clone_excluded_m2o_or_o2m_fields_mock.return_value = ['test']
def test_clone_m2o_or_o2m_fields_check(
self, _clone_m2o_or_o2m_fields_mock, _clone_excluded_m2o_or_o2m_fields_mock
):
_clone_m2o_or_o2m_fields_mock.return_value = ["test"]
_clone_excluded_m2o_or_o2m_fields_mock.return_value = ["test"]

errors = Edition.check()
expected_errors = [
Expand All @@ -730,8 +736,8 @@ def test_clone_m2o_or_o2m_fields_check(self, _clone_m2o_or_o2m_fields_mock, _clo
hint=(
'Please provide either "_clone_m2o_or_o2m_fields"'
+ ' or "_clone_excluded_m2o_or_o2m_fields" for model {}'.format(
Edition.__name__,
)
Edition.__name__,
)
),
obj=Edition,
id="{}.E002".format(ModelCloneConfig.name),
Expand All @@ -747,9 +753,11 @@ def test_clone_m2o_or_o2m_fields_check(self, _clone_m2o_or_o2m_fields_mock, _clo
"sample.models.Edition._clone_excluded_o2o_fields",
new_callable=PropertyMock,
)
def test_clone_o2o_fields_check(self, _clone_o2o_fields_mock, _clone_excluded_o2o_fields_mock):
_clone_o2o_fields_mock.return_value = ['test']
_clone_excluded_o2o_fields_mock.return_value = ['test']
def test_clone_o2o_fields_check(
self, _clone_o2o_fields_mock, _clone_excluded_o2o_fields_mock
):
_clone_o2o_fields_mock.return_value = ["test"]
_clone_excluded_o2o_fields_mock.return_value = ["test"]

errors = Edition.check()
expected_errors = [
Expand All @@ -758,8 +766,8 @@ def test_clone_o2o_fields_check(self, _clone_o2o_fields_mock, _clone_excluded_o2
hint=(
'Please provide either "_clone_o2o_fields"'
+ ' or "_clone_excluded_o2o_fields" for model {}'.format(
Edition.__name__,
)
Edition.__name__,
)
),
obj=Edition,
id="{}.E002".format(ModelCloneConfig.name),
Expand Down

0 comments on commit 9545c1b

Please sign in to comment.