Skip to content

assert_one() failures are noisy and unfriendly #31

@StevenMaude

Description

@StevenMaude
Traceback (most recent call last):
  File "/home/me/.virtualenvs/databaker/bin/bake", line 11, in <module>
    sys.exit(main())
  File "/home/me/.virtualenvs/databaker/local/lib/python2.7/site-packages/databaker/bake.py", line 328, in main
    per_file(fn, recipe)
  File "/home/me/.virtualenvs/databaker/local/lib/python2.7/site-packages/databaker/bake.py", line 272, in per_file
    obs = recipe.per_tab(tab)
  File "a02.py", line 7, in per_tab
    obs = tab.filter("All Persons").assert_one().shift(DOWN)
  File "/home/me/.virtualenvs/databaker/local/lib/python2.7/site-packages/xypath/xypath.py", line 425, in assert_one
    len(self.__store)
xypath.xypath.MultipleCellsAssertionError: assert_one() : 2 cells in bag, not 1
exit: 0.089s,  3.129s total

Perhaps it should show the full output if --debug is enabled and otherwise something more concise like so that the user can immediately see the problem:

2 cells in bag, not 1 found in:
  File "a02.py", line 7, in per_tab
obs = tab.filter("All Persons").assert_one().shift(DOWN)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions