Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos #9662

Merged
merged 5 commits into from
Mar 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/community/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Date: 15th March 2024
* Fix 404 when page query parameter is empty string [[#8578](https://github.com/encode/django-rest-framework/pull/8578)]
* 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)]
* FloatField will crash if the input is a number that is too big [[#8725](https://github.com/encode/django-rest-framework/pull/8725)]
* Add missing DurationField to SimpleMetada label_lookup [[#8702](https://github.com/encode/django-rest-framework/pull/8702)]
* Add missing DurationField to SimpleMetadata label_lookup [[#8702](https://github.com/encode/django-rest-framework/pull/8702)]
* Add support for Python 3.11 [[#8752](https://github.com/encode/django-rest-framework/pull/8752)]
* Make request consistently available in pagination classes [[#8764](https://github.com/encode/django-rest-framework/pull/9764)]
* Possibility to remove trailing zeros on DecimalFields representation [[#6514](https://github.com/encode/django-rest-framework/pull/6514)]
Expand Down Expand Up @@ -428,7 +428,7 @@ Be sure to upgrade to Python 3 before upgrading to Django REST Framework 3.10.
* Allow hashing of ErrorDetail. [#5932][gh5932]
* Correct schema parsing for JSONField [#5878][gh5878]
* Render descriptions (from help_text) using safe [#5869][gh5869]
* Removed input value from deault_error_message [#5881][gh5881]
* Removed input value from default_error_message [#5881][gh5881]
* Added min_value/max_value support in DurationField [#5643][gh5643]
* Fixed instance being overwritten in pk-only optimization try/except block [#5747][gh5747]
* Fixed AttributeError from items filter when value is None [#5981][gh5981]
Expand Down
4 changes: 2 additions & 2 deletions docs/community/tutorials-and-resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ There are a wide range of resources available for learning and using Django REST
### Talks

* [Level Up! Rethinking the Web API Framework][pycon-us-2017]
* [How to Make a Full Fledged REST API with Django OAuth Toolkit][full-fledged-rest-api-with-django-oauth-tookit]
* [How to Make a Full Fledged REST API with Django OAuth Toolkit][full-fledged-rest-api-with-django-oauth-toolkit]
* [Django REST API - So Easy You Can Learn It in 25 Minutes][django-rest-api-so-easy]
* [Tom Christie about Django Rest Framework at Django: Under The Hood][django-under-hood-2014]
* [Django REST Framework: Schemas, Hypermedia & Client Libraries][pycon-uk-2016]
Expand Down Expand Up @@ -122,7 +122,7 @@ Want your Django REST Framework talk/tutorial/article to be added to our website
[django-polls-api]: https://learndjango.com/tutorials/django-polls-tutorial-api
[django-rest-framework-todo-api]: https://learndjango.com/tutorials/django-rest-framework-tutorial-todo-api
[django-rest-api-so-easy]: https://www.youtube.com/watch?v=cqP758k1BaQ
[full-fledged-rest-api-with-django-oauth-tookit]: https://www.youtube.com/watch?v=M6Ud3qC2tTk
[full-fledged-rest-api-with-django-oauth-toolkit]: https://www.youtube.com/watch?v=M6Ud3qC2tTk
[drf-in-your-pjs]: https://www.youtube.com/watch?v=xMtHsWa72Ww
[building-a-rest-api-using-django-and-drf]: https://www.youtube.com/watch?v=PwssEec3IRw
[drf-tutorials]: https://www.youtube.com/watch?v=axRCBgbOJp8&list=PLJtp8Jm8EDzjgVg9vVyIUMoGyqtegj7FH
Expand Down
2 changes: 1 addition & 1 deletion tests/schemas/test_coreapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@ class NamingCollisionViewSet(GenericViewSet):
"""
Example via: https://stackoverflow.com/questions/43778668/django-rest-framwork-occured-typeerror-link-object-does-not-support-item-ass/
"""
permision_class = ()
permission_classes = ()

@action(detail=False)
def detail(self, request):
Expand Down
14 changes: 7 additions & 7 deletions tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class SearchSplitTests(SimpleTestCase):

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

def test_strips_commas_around_quoted(self):
Expand Down Expand Up @@ -516,7 +516,7 @@ def description(self):


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


Expand Down Expand Up @@ -725,9 +725,9 @@ class OrderingListView(generics.ListAPIView):
def test_ordering_by_aggregate_field(self):
# create some related models to aggregate order by
num_objs = [2, 5, 3]
for obj, num_relateds in zip(OrderingFilterModel.objects.all(),
num_objs):
for _ in range(num_relateds):
for obj, num_related in zip(OrderingFilterModel.objects.all(),
num_objs):
for _ in range(num_related):
new_related = OrderingFilterRelatedModel(
related_object=obj
)
Expand All @@ -739,10 +739,10 @@ class OrderingListView(generics.ListAPIView):
ordering = 'title'
ordering_fields = '__all__'
queryset = OrderingFilterModel.objects.all().annotate(
models.Count("relateds"))
models.Count("related"))

view = OrderingListView.as_view()
request = factory.get('/', {'ordering': 'relateds__count'})
request = factory.get('/', {'ordering': 'related__count'})
response = view(request)
assert response.data == [
{'id': 1, 'title': 'zyx', 'text': 'abc'},
Expand Down
2 changes: 1 addition & 1 deletion tests/test_model_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ def setUp(self):
)
self.instance.many_to_many.set(self.many_to_many_targets)

def test_pk_retrival(self):
def test_pk_retrieval(self):
class TestSerializer(serializers.ModelSerializer):
class Meta:
model = RelationalModel
Expand Down
4 changes: 2 additions & 2 deletions tests/test_negotiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def test_client_specifies_parameter(self):

def test_match_is_false_if_main_types_not_match(self):
mediatype = _MediaType('test_1')
anoter_mediatype = _MediaType('test_2')
assert mediatype.match(anoter_mediatype) is False
another_mediatype = _MediaType('test_2')
assert mediatype.match(another_mediatype) is False

def test_mediatype_match_is_false_if_keys_not_match(self):
mediatype = _MediaType(';test_param=foo')
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ def test_ending_offset(self):
]
}

def test_erronous_offset(self):
def test_erroneous_offset(self):
request = Request(factory.get('/', {'limit': 5, 'offset': 1000}))
queryset = self.paginate_queryset(request)
self.get_paginated_content(queryset)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ def test_several_levels_and_precedence(self):
)
assert composed_perm().has_permission(request, None) is True

def test_or_lazyness(self):
def test_or_laziness(self):
request = factory.get('/1', format='json')
request.user = AnonymousUser()

Expand All @@ -644,7 +644,7 @@ def test_or_lazyness(self):
assert mock_deny.call_count == 1
assert mock_allow.call_count == 1

def test_object_or_lazyness(self):
def test_object_or_laziness(self):
request = factory.get('/1', format='json')
request.user = AnonymousUser()

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

def test_and_lazyness(self):
def test_and_laziness(self):
request = factory.get('/1', format='json')
request.user = AnonymousUser()

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

def test_object_and_lazyness(self):
def test_object_and_laziness(self):
request = factory.get('/1', format='json')
request.user = AnonymousUser()

Expand Down
4 changes: 2 additions & 2 deletions tests/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ class Meta:
"with a `UniqueTogetherValidator` using the desired field names.")
assert str(excinfo.value) == expected

def test_allow_explict_override(self):
def test_allow_explicit_override(self):
"""
Ensure validators can be explicitly removed..
"""
Expand Down Expand Up @@ -664,7 +664,7 @@ def test_single_field_uniq_validators(self):
UniqueConstraint with single field must be transformed into
field's UniqueValidator
"""
# Django 5 includes Max and Min values validators for IntergerField
# Django 5 includes Max and Min values validators for IntegerField
extra_validators_qty = 2 if django_version[0] >= 5 else 0
serializer = UniqueConstraintSerializer()
assert len(serializer.validators) == 2
Expand Down
4 changes: 2 additions & 2 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def custom_handler(exc, context):
return Response({'error': 'UnknownError'}, status=500)


class OverridenSettingsView(APIView):
class OverriddenSettingsView(APIView):
settings = APISettings({'EXCEPTION_HANDLER': custom_handler})

def get(self, request, *args, **kwargs):
Expand Down Expand Up @@ -131,7 +131,7 @@ def test_function_based_view_exception_handler(self):

class TestCustomSettings(TestCase):
def setUp(self):
self.view = OverridenSettingsView.as_view()
self.view = OverriddenSettingsView.as_view()

def test_get_exception_handler(self):
request = factory.get('/', content_type='application/json')
Expand Down
Loading