-
-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get row method #557
Get row method #557
Conversation
=================================== FAILURES ===================================
___________________________ TablibTestCase.test_get ____________________________
Traceback (most recent call last):
File "/Users/runner/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/unittest/case.py", line 59, in testPartExecutor
yield
File "/Users/runner/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/unittest/case.py", line 592, in run
self._callTestMethod(testMethod)
File "/Users/runner/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/unittest/case.py", line 550, in _callTestMethod
method()
File "/Users/runner/work/tablib/tablib/tests/test_tablib.py", line 209, in test_get
self.assertRaises(self.founders.get(3), IndexError)
File "/Users/runner/work/tablib/tablib/.tox/py/lib/python3.9/site-packages/tablib/core.py", line 507, in get
return self[index]
File "/Users/runner/work/tablib/tablib/.tox/py/lib/python3.9/site-packages/tablib/core.py", line 173, in __getitem__
_results = self._data[key]
IndexError: list index out of range def test_get(self):
"""Verify getting rows by index"""
self.assertEqual(self.founders.get(0), self.john)
self.assertEqual(self.founders.get(1), self.george)
self.assertEqual(self.founders.get(2), self.tom)
self.assertEqual(self.founders.get(-1), self.tom)
self.assertEqual(self.founders.get(-2), self.george)
self.assertEqual(self.founders.get(-3), self.john)
self.assertRaises(self.founders.get(3), IndexError) # <- 🤦 Let me fix this real quick. Also forgot to build the docs, so getting that done too. |
Codecov Report
@@ Coverage Diff @@
## master #557 +/- ##
==========================================
+ Coverage 91.37% 91.64% +0.26%
==========================================
Files 28 28
Lines 2713 2800 +87
==========================================
+ Hits 2479 2566 +87
Misses 234 234
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
i was originally gonna, but all the row methods in the class don't have |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, good point!
Thank you!
Did you check if the docs should be updated somewhere? |
I built the docs locally and it looks like it added it by me, so the existing rst files appear to pick it up. |
We could add an example to the quickstart guide: https://tablib.readthedocs.io/en/stable/tutorial.html#selecting-rows-columns |
Realized that the >>> data.get(0)
('Kenneth', 'Reitz', 22)
>>> data.get('First Name')
['Kenneth', 'Bessie'] would be inconsistent and confusing. |
The "add type validation" commit should not be part of this PR. |
Also accidentally ran black on fixing a flake8 issue running tox 🙃 |
Yeah I just noticed it changed more than I intended. |
7dcd214
to
3b36bfc
Compare
🏅 |
Fixes #24 get_row, get_col methods