Opened 15 years ago
Closed 15 years ago
#15647 closed (fixed)
in_bulk() should not type check its input
| Reported by: | Calvin Spealman | Owned by: | nobody |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | yes | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
#12251 added additional types it will allow, but why does it typecheck at all? For example, I wanted to pass it a ValuesList, which had come from queryset.values_list('id', flat=True), but I don't just want another type added to the assert. Can the assert be removed entirely? it should work with any iterable I pass it.
Attachments (1)
Change History (4)
comment:1 by , 15 years ago
| Needs tests: | set |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
by , 15 years ago
| Attachment: | 15647-in-bulk-accepts-iterables.patch added |
|---|
Removes assert from in_bulk and adds tests for iterables passed to it
comment:2 by , 15 years ago
| Has patch: | set |
|---|
I made the tests against a more generic iterable, falling in line with the reasoning that the problem is type-specific logic so I didn't want to test just one more type on it.
Good question. I don't recall why we added that typechecking, but it seems like we could just remove it. Can you (or somebody) write some tests that allow the passing of any iterable, like a ValuesList?