Closed cpzt closed 4 years ago
Thanks. It would be great if you could provide a test case, at least to see what's broken currently!
Thank you for your prompt response. The test code already exists in TablibTestCase.test_row_lpush
, len (john) == len (george) is just a coincidence.
Hmmm... when re-reading this lpush
/rpush
stuff on Row
, it looks like it is completely reversed! And the append
is in fact prepeding values. Can you confirm this "mess"?
Oh, look!
Python 3.8.1 (v3.8.1:1b293b6006, Dec 18 2019, 14:08:53)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from tablib.core import Row, detect_format
>>> john = Row(('John', 'Adams', 90))
>>> george = Row(('George', 'Washington', 67))
>>> tom = Row(('Thomas', 'Jefferson', 50))
>>> john
['John', 'Adams', 90]
>>> type(john)
<class 'tablib.core.Row'>
>>> john.lpush(tom)
>>> john
['John', 'Adams', 90, ['Thomas', 'Jefferson', 50]]
>>> john.lpush(george)
>>> john
['John', 'Adams', 90, ['George', 'Washington', 67], ['Thomas', 'Jefferson', 50]]
>>> john[-1]
['Thomas', 'Jefferson', 50]
>>> john = Row(('John', 'Adams', 90))
>>> john
['John', 'Adams', 90]
>>> john.append(tom)
>>> john
[['Thomas', 'Jefferson', 50], 'John', 'Adams', 90]
>>> john.append(george)
>>> john
[['George', 'Washington', 67], ['Thomas', 'Jefferson', 50], 'John', 'Adams', 90]
>>>
lpush
a number will cause an error
>>> from tablib.core import Row
>>> john = Row(('John', 'Adams', 90))
>>> john.lpush(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/chim/.pyenv/versions/3.7.6/lib/python3.7/site-packages/tablib/core.py", line 77, in lpush
self.insert(len(value), value)
TypeError: object of type 'int' has no len()
lpush
, rpush
, append
are another issue. BTW, Is there any purpose of this opposite operation design of lpush
and rpush
?
I created #454, @qianmosolo I would appreciate your review.
Codecov Report
82.98% <100%> (ø)
98.52% <100%> (ø)
Continue to review full report at Codecov.