Looking at the other assertion methods inherited from `unittest.TestCase`
they're incredibly cased (e.g. `assertMultiLineEqual`) so I'm not finding
any convention of not uppercasing liberally.
My suggestion is to rename `assertFormsetError`->`assertFormSetError` and
`assertQuerysetEqual`->`assertQuerySetEqual` in `django.test.TestCase` and
add aliases for the old names so as not to break existing code. In the
code base this is a quite small change, but there's likely some docs (and
e.g. the tutorial) that might warrant updating to new spelling. Could also
(down the line) add a deprecationwarning to get rid of the old spelling if
you want a cleaner API interface.
This bit me as I was following the tutorial and re-typing the code instead
of copy-pasting, so it's plausible that others might encounter it
similarly if they don't have an IDE that suggests the alternate spelling.
--
Ticket URL: <https://code.djangoproject.com/ticket/33990>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => Anvansh Singh
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/33990#comment:1>
* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Accepted
Comment:
OK — I'm not 100% convinced this is worth the change, so if someone wants
to mark it `wontfix` I won't complain, but… — let's accept as a cleanup
for the `assertFormsetError` and `assertQuerysetEqual` methods.
* Uses in Django will need to be updated.
* The old names will need to be deprecated. (Let's not have two versions
floating around...)
* A matching Issue/PR should be created on The
[https://github.com/adamchainz/django-upgrade django-upgrade project] when
this goes in.
--
Ticket URL: <https://code.djangoproject.com/ticket/33990#comment:2>
* owner: Anvansh Singh => Michael Howitz
Comment:
Taking over the assignment as I am on a sprint and able to work on it.
--
Ticket URL: <https://code.djangoproject.com/ticket/33990#comment:3>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/33990#comment:4>
Comment (by David Sanders):
Just checking the docs to see how things are named there compared to the
code: Looks like QuerySet is capitalised as per code but "Formset" tends
to use classic sentence casing:
ie see how QuerySet is used in a sentence:
https://docs.djangoproject.com/en/4.1/ref/models/querysets/
compared to how "formset" is used in a sentence:
https://docs.djangoproject.com/en/4.1/topics/forms/formsets/
--
Ticket URL: <https://code.djangoproject.com/ticket/33990#comment:5>
* cc: David Sanders (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/33990#comment:6>
Comment (by Michael Howitz):
The issue in `django-upgrade` is https://github.com/adamchainz/django-
upgrade/issues/252.
--
Ticket URL: <https://code.djangoproject.com/ticket/33990#comment:7>
Comment (by Michael Howitz):
The PR in `django-upgrade` is https://github.com/adamchainz/django-
upgrade/pull/253.
--
Ticket URL: <https://code.djangoproject.com/ticket/33990#comment:8>
* needs_better_patch: 0 => 1
* needs_docs: 0 => 1
Comment:
[https://github.com/django/django/pull/16110 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/33990#comment:9>
* needs_better_patch: 1 => 0
* needs_docs: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/33990#comment:10>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"564b317fb53e9925b86ca5ef5d3bbcf99387602c" 564b317f]:
{{{
#!CommitTicketReference repository=""
revision="564b317fb53e9925b86ca5ef5d3bbcf99387602c"
Refs #33990 -- Renamed SimpleTestCase.assertFormsetError() to
assertFormSetError().
Co-Authored-By: Michael Howitz <m...@gocept.com>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33990#comment:11>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/33990#comment:12>
* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/33990#comment:13>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"f0c06f8ab7904e1fd082f2de57337f6c7e05f177" f0c06f8a]:
{{{
#!CommitTicketReference repository=""
revision="f0c06f8ab7904e1fd082f2de57337f6c7e05f177"
Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to
assertQuerySetEqual().
Co-Authored-By: Michael Howitz <m...@gocept.com>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33990#comment:14>
* status: assigned => closed
* resolution: => fixed
--
Ticket URL: <https://code.djangoproject.com/ticket/33990#comment:15>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"69af3bea9987044c944b5bc83e32c35f0a73c6dd" 69af3bea]:
{{{
#!CommitTicketReference repository=""
revision="69af3bea9987044c944b5bc83e32c35f0a73c6dd"
Refs #33990 -- Removed TransactionTestCase.assertQuerysetEqual() per
deprecation timeline.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33990#comment:17>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"c35fd9e2750a3e49a57d9fef964b9ef3e7cb49cb" c35fd9e2]:
{{{
#!CommitTicketReference repository=""
revision="c35fd9e2750a3e49a57d9fef964b9ef3e7cb49cb"
Refs #33990 -- Removed SimpleTestCase.assertFormsetError() per deprecation
timeline.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33990#comment:16>