Skip to content

Commit 73cbb9c

Browse files
authored
Fix typos (#9662)
* Fix typo of 'related' in tests * Fix typo of permission_classes in coreapi test * Fix some minor typos in docs * Fix typos in tests * Fix flake8 issue
1 parent 1e8ac7c commit 73cbb9c

10 files changed

+24
-24
lines changed

docs/community/release-notes.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Date: 15th March 2024
121121
* Fix 404 when page query parameter is empty string [[#8578](https://github.com/encode/django-rest-framework/pull/8578)]
122122
* Fixes instance check in ListSerializer.to_representation [[#8726](https://github.com/encode/django-rest-framework/pull/8726)] [[#8727](https://github.com/encode/django-rest-framework/pull/8727)]
123123
* FloatField will crash if the input is a number that is too big [[#8725](https://github.com/encode/django-rest-framework/pull/8725)]
124-
* Add missing DurationField to SimpleMetada label_lookup [[#8702](https://github.com/encode/django-rest-framework/pull/8702)]
124+
* Add missing DurationField to SimpleMetadata label_lookup [[#8702](https://github.com/encode/django-rest-framework/pull/8702)]
125125
* Add support for Python 3.11 [[#8752](https://github.com/encode/django-rest-framework/pull/8752)]
126126
* Make request consistently available in pagination classes [[#8764](https://github.com/encode/django-rest-framework/pull/9764)]
127127
* Possibility to remove trailing zeros on DecimalFields representation [[#6514](https://github.com/encode/django-rest-framework/pull/6514)]
@@ -428,7 +428,7 @@ Be sure to upgrade to Python 3 before upgrading to Django REST Framework 3.10.
428428
* Allow hashing of ErrorDetail. [#5932][gh5932]
429429
* Correct schema parsing for JSONField [#5878][gh5878]
430430
* Render descriptions (from help_text) using safe [#5869][gh5869]
431-
* Removed input value from deault_error_message [#5881][gh5881]
431+
* Removed input value from default_error_message [#5881][gh5881]
432432
* Added min_value/max_value support in DurationField [#5643][gh5643]
433433
* Fixed instance being overwritten in pk-only optimization try/except block [#5747][gh5747]
434434
* Fixed AttributeError from items filter when value is None [#5981][gh5981]

docs/community/tutorials-and-resources.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ There are a wide range of resources available for learning and using Django REST
5050
### Talks
5151

5252
* [Level Up! Rethinking the Web API Framework][pycon-us-2017]
53-
* [How to Make a Full Fledged REST API with Django OAuth Toolkit][full-fledged-rest-api-with-django-oauth-tookit]
53+
* [How to Make a Full Fledged REST API with Django OAuth Toolkit][full-fledged-rest-api-with-django-oauth-toolkit]
5454
* [Django REST API - So Easy You Can Learn It in 25 Minutes][django-rest-api-so-easy]
5555
* [Tom Christie about Django Rest Framework at Django: Under The Hood][django-under-hood-2014]
5656
* [Django REST Framework: Schemas, Hypermedia & Client Libraries][pycon-uk-2016]
@@ -122,7 +122,7 @@ Want your Django REST Framework talk/tutorial/article to be added to our website
122122
[django-polls-api]: https://learndjango.com/tutorials/django-polls-tutorial-api
123123
[django-rest-framework-todo-api]: https://learndjango.com/tutorials/django-rest-framework-tutorial-todo-api
124124
[django-rest-api-so-easy]: https://www.youtube.com/watch?v=cqP758k1BaQ
125-
[full-fledged-rest-api-with-django-oauth-tookit]: https://www.youtube.com/watch?v=M6Ud3qC2tTk
125+
[full-fledged-rest-api-with-django-oauth-toolkit]: https://www.youtube.com/watch?v=M6Ud3qC2tTk
126126
[drf-in-your-pjs]: https://www.youtube.com/watch?v=xMtHsWa72Ww
127127
[building-a-rest-api-using-django-and-drf]: https://www.youtube.com/watch?v=PwssEec3IRw
128128
[drf-tutorials]: https://www.youtube.com/watch?v=axRCBgbOJp8&list=PLJtp8Jm8EDzjgVg9vVyIUMoGyqtegj7FH

tests/schemas/test_coreapi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ class NamingCollisionViewSet(GenericViewSet):
11771177
"""
11781178
Example via: https://stackoverflow.com/questions/43778668/django-rest-framwork-occured-typeerror-link-object-does-not-support-item-ass/
11791179
"""
1180-
permision_class = ()
1180+
permission_classes = ()
11811181

11821182
@action(detail=False)
11831183
def detail(self, request):

tests/test_filters.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
class SearchSplitTests(SimpleTestCase):
2121

22-
def test_keep_quoted_togheter_regardless_of_commas(self):
22+
def test_keep_quoted_together_regardless_of_commas(self):
2323
assert ['hello, world'] == list(filters.search_smart_split('"hello, world"'))
2424

2525
def test_strips_commas_around_quoted(self):
@@ -516,7 +516,7 @@ def description(self):
516516

517517

518518
class OrderingFilterRelatedModel(models.Model):
519-
related_object = models.ForeignKey(OrderingFilterModel, related_name="relateds", on_delete=models.CASCADE)
519+
related_object = models.ForeignKey(OrderingFilterModel, related_name="related", on_delete=models.CASCADE)
520520
index = models.SmallIntegerField(help_text="A non-related field to test with", default=0)
521521

522522

@@ -725,9 +725,9 @@ class OrderingListView(generics.ListAPIView):
725725
def test_ordering_by_aggregate_field(self):
726726
# create some related models to aggregate order by
727727
num_objs = [2, 5, 3]
728-
for obj, num_relateds in zip(OrderingFilterModel.objects.all(),
729-
num_objs):
730-
for _ in range(num_relateds):
728+
for obj, num_related in zip(OrderingFilterModel.objects.all(),
729+
num_objs):
730+
for _ in range(num_related):
731731
new_related = OrderingFilterRelatedModel(
732732
related_object=obj
733733
)
@@ -739,10 +739,10 @@ class OrderingListView(generics.ListAPIView):
739739
ordering = 'title'
740740
ordering_fields = '__all__'
741741
queryset = OrderingFilterModel.objects.all().annotate(
742-
models.Count("relateds"))
742+
models.Count("related"))
743743

744744
view = OrderingListView.as_view()
745-
request = factory.get('/', {'ordering': 'relateds__count'})
745+
request = factory.get('/', {'ordering': 'related__count'})
746746
response = view(request)
747747
assert response.data == [
748748
{'id': 1, 'title': 'zyx', 'text': 'abc'},

tests/test_model_serializer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ def setUp(self):
797797
)
798798
self.instance.many_to_many.set(self.many_to_many_targets)
799799

800-
def test_pk_retrival(self):
800+
def test_pk_retrieval(self):
801801
class TestSerializer(serializers.ModelSerializer):
802802
class Meta:
803803
model = RelationalModel

tests/test_negotiation.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ def test_client_specifies_parameter(self):
6161

6262
def test_match_is_false_if_main_types_not_match(self):
6363
mediatype = _MediaType('test_1')
64-
anoter_mediatype = _MediaType('test_2')
65-
assert mediatype.match(anoter_mediatype) is False
64+
another_mediatype = _MediaType('test_2')
65+
assert mediatype.match(another_mediatype) is False
6666

6767
def test_mediatype_match_is_false_if_keys_not_match(self):
6868
mediatype = _MediaType(';test_param=foo')

tests/test_pagination.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ def test_ending_offset(self):
513513
]
514514
}
515515

516-
def test_erronous_offset(self):
516+
def test_erroneous_offset(self):
517517
request = Request(factory.get('/', {'limit': 5, 'offset': 1000}))
518518
queryset = self.paginate_queryset(request)
519519
self.get_paginated_content(queryset)

tests/test_permissions.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ def test_several_levels_and_precedence(self):
624624
)
625625
assert composed_perm().has_permission(request, None) is True
626626

627-
def test_or_lazyness(self):
627+
def test_or_laziness(self):
628628
request = factory.get('/1', format='json')
629629
request.user = AnonymousUser()
630630

@@ -644,7 +644,7 @@ def test_or_lazyness(self):
644644
assert mock_deny.call_count == 1
645645
assert mock_allow.call_count == 1
646646

647-
def test_object_or_lazyness(self):
647+
def test_object_or_laziness(self):
648648
request = factory.get('/1', format='json')
649649
request.user = AnonymousUser()
650650

@@ -664,7 +664,7 @@ def test_object_or_lazyness(self):
664664
assert mock_deny.call_count == 0
665665
assert mock_allow.call_count == 1
666666

667-
def test_and_lazyness(self):
667+
def test_and_laziness(self):
668668
request = factory.get('/1', format='json')
669669
request.user = AnonymousUser()
670670

@@ -684,7 +684,7 @@ def test_and_lazyness(self):
684684
assert mock_deny.call_count == 1
685685
mock_allow.assert_not_called()
686686

687-
def test_object_and_lazyness(self):
687+
def test_object_and_laziness(self):
688688
request = factory.get('/1', format='json')
689689
request.user = AnonymousUser()
690690

tests/test_validators.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ class Meta:
406406
"with a `UniqueTogetherValidator` using the desired field names.")
407407
assert str(excinfo.value) == expected
408408

409-
def test_allow_explict_override(self):
409+
def test_allow_explicit_override(self):
410410
"""
411411
Ensure validators can be explicitly removed..
412412
"""
@@ -664,7 +664,7 @@ def test_single_field_uniq_validators(self):
664664
UniqueConstraint with single field must be transformed into
665665
field's UniqueValidator
666666
"""
667-
# Django 5 includes Max and Min values validators for IntergerField
667+
# Django 5 includes Max and Min values validators for IntegerField
668668
extra_validators_qty = 2 if django_version[0] >= 5 else 0
669669
serializer = UniqueConstraintSerializer()
670670
assert len(serializer.validators) == 2

tests/test_views.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def custom_handler(exc, context):
4747
return Response({'error': 'UnknownError'}, status=500)
4848

4949

50-
class OverridenSettingsView(APIView):
50+
class OverriddenSettingsView(APIView):
5151
settings = APISettings({'EXCEPTION_HANDLER': custom_handler})
5252

5353
def get(self, request, *args, **kwargs):
@@ -131,7 +131,7 @@ def test_function_based_view_exception_handler(self):
131131

132132
class TestCustomSettings(TestCase):
133133
def setUp(self):
134-
self.view = OverridenSettingsView.as_view()
134+
self.view = OverriddenSettingsView.as_view()
135135

136136
def test_get_exception_handler(self):
137137
request = factory.get('/', content_type='application/json')

0 commit comments

Comments
 (0)