Skip to content

Commit

Permalink
test: Expand test failure message for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Jul 15, 2021
1 parent c6222f3 commit b4f7b71
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* feat: :class:`.TypeTester` accepts a ``null_values`` keyword argument. (#745)
* feat: :class:`.Min`, :class:`.Max` and :class:`.Sum` (#735) work with :class:`.TimeDelta`.
* feat: :class:`.FieldSizeLimitError` includes the line number in the error message. (#681)
* feat: :class:`.csv.Sniffer` warns on error while sniffing CSV dialect.
* fix: :meth:`.Table.normalize` works with basic processing methods. (#691)
* fix: :meth:`.Table.homogenize` casts ``compare_values`` and ``default_row``. (#700)
* fix: :meth:`.Table.homogenize` works with basic processing methods. (#756)
Expand Down
3 changes: 2 additions & 1 deletion agate/csv_py2.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ def sniff(self, sample):
"""
try:
dialect = csv.Sniffer().sniff(sample, POSSIBLE_DELIMITERS)
except csv.Error:
except csv.Error as e:
warnings.warn('Error sniffing CSV dialect: %s' % e, RuntimeWarning, stacklevel=2)
dialect = None

return dialect
Expand Down
3 changes: 2 additions & 1 deletion tests/test_py3.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,5 @@ def test_sniffer(self):
contents = f.read()
actual = csv_py3.Sniffer().sniff(contents).__dict__
expected = csv.Sniffer().sniff(contents).__dict__
self.assertEqual(actual, expected, '%r != %r' % (actual, expected))
alternate = csv.Sniffer().sniff(contents, csv_py3.POSSIBLE_DELIMITERS).__dict__
self.assertEqual(actual, expected, '%r != %r (%r)' % (actual, expected, alternate))

0 comments on commit b4f7b71

Please sign in to comment.