#24667 closed Bug (fixed)
Some tests in model_field suite don't actually do anything
Reported by: | Yoong Kang Lim | Owned by: | Yoong Kang Lim |
---|---|---|---|
Component: | Testing framework | Version: | 1.8 |
Severity: | Normal | Keywords: | tests |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
I ran the model_fields test suite. In this suite there is a test called test_cardinality_m2m.
The test is supposed to iterate through a collection of fields and run some tests on each field in the collection.
These asserts never actually get called because the collection is empty.
To reproduce, simply run the following:
PYTHONPATH=..$PYTHONPATH ./runtests.py model_fields
The other tests in model_fields look like they may have the same problem.
Change History (5)
comment:1 by , 10 years ago
Easy pickings: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 10 years ago
Has patch: | set |
---|
Note:
See TracTickets
for help on using tickets.
Hi,
If I understand correctly, the problem is that a generator comprehension is used so it can only be iterated over once.
We should use a list comprehension instead.