• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

petl-developers / petl / 43495886813
94%

Build:
DEFAULT BRANCH: master
Ran 13 Nov 2026 07:52PM UTC
Jobs 1
Files 136
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

13 Nov 2026 07:49PM UTC coverage: 93.768% (+0.01%) from 93.755%
43495886813

push

github

web-flow
fix: accept a single tuple or list field selection in valuecounter() and valuecounts() (#812)

This has the objective of accepting a compound field selection passed
as a single tuple or list in `valuecounter()` and `valuecounts()`, the
way `values()` already does.

Changes:
1. Fixed a bug in `valuecounter()`: it passed its `*field` varargs to
`values()` as one argument, double-wrapping a single tuple/list selector
into a nested tuple that `asindices()` rejects with
`FieldSelectionError`. `valuecounter(table, ('foo', 'bar'))` and
`valuecounter(table, ['foo', 'bar'])` now count the `('foo', 'bar')`
compound key, identical to `valuecounter(table, 'foo', 'bar')` /
`valuecounter(table, *fields)`.
2. Fixed the same bug in `valuecounts()`: `ValueCountsView` kept the
wrapped form, so a single tuple/list argument failed with the same error
on iteration. `ValueCountsView.__init__` now unwraps a single container
argument like `ValuesView.__init__` does (only when the element is
itself a tuple/list, since `__iter__` splats `*self.field` — a bare
string element must not be splatted into characters).
3. Repointed `test_valuecounter_invalid_tuple_field_message` at a
genuinely invalid selector (`(('foo', 'bar'),)`), so the tuple rendering
of the `FieldSelectionError` message stays covered; a valid compound
selection no longer raises.
4. Documented the behavior in the `valuecounter` docstring (doctest
included) and in `docs/changes.rst`.

The rest of petl already accepts this form: `values()`, `valuecount()`,
`typecounter()`, `typecounts()`, `stringpatterncounter()`,
`stringpatterns()`, `parsecounter()` and `parsecounts()` all take a
single tuple/list of fields as a compound selection — only
`valuecounter()`/`valuecounts()` rejected it, which is what #641 ran
into.

Closes #641
Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com>

28 of 28 new or added lines in 3 files covered. (100.0%)

16883 of 18005 relevant lines covered (93.77%)

0.94 hits per line

Jobs
ID Job ID Ran Files Coverage
1 43495886813.1 13 Nov 2026 07:52PM UTC 136
93.77
GitHub Action Run
Source Files on build 43495886813
  • Tree
  • List 136
  • Changed 4
  • Source Changed 0
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 52324557 on github
  • Prev Build on master (#43493020630)
  • Next Build on master (#43496779047)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc