mirror of
https://github.com/kennethreitz/tablib.git
synced 2026-06-05 23:10:17 +00:00
Co-authored-by: chim <chenpan@xiaomai5.com>
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
# History
|
||||
|
||||
## 2.0.0 (Unreleased)
|
||||
|
||||
### Breaking changes
|
||||
|
||||
- The `Row.lpush/rpush` logic was reversed. `lpush` was appending while `rpush`
|
||||
and `append` were prepending. This was fixed (reversed behavior). If you
|
||||
counted on the broken behavior, please update your code (#453).
|
||||
|
||||
## 1.1.0 (2020-02-13)
|
||||
|
||||
### Deprecations
|
||||
|
||||
+2
-2
@@ -71,10 +71,10 @@ class Row:
|
||||
setattr(self, k, v)
|
||||
|
||||
def rpush(self, value):
|
||||
self.insert(0, value)
|
||||
self.insert(len(self._row), value)
|
||||
|
||||
def lpush(self, value):
|
||||
self.insert(len(value), value)
|
||||
self.insert(0, value)
|
||||
|
||||
def append(self, value):
|
||||
self.rpush(value)
|
||||
|
||||
+4
-16
@@ -556,27 +556,15 @@ class TablibTestCase(BaseTestCase):
|
||||
|
||||
def test_row_lpush(self):
|
||||
"""Row lpush."""
|
||||
# Arrange
|
||||
john = Row(self.john)
|
||||
george = Row(self.george)
|
||||
|
||||
# Act
|
||||
john.lpush(george)
|
||||
|
||||
# Assert
|
||||
self.assertEqual(john[-1], george)
|
||||
john.lpush(53)
|
||||
self.assertEqual(john.list, [53, 'John', 'Adams', 90])
|
||||
|
||||
def test_row_append(self):
|
||||
"""Row append."""
|
||||
# Arrange
|
||||
john = Row(self.john)
|
||||
george = Row(self.george)
|
||||
|
||||
# Act
|
||||
john.append(george)
|
||||
|
||||
# Assert
|
||||
self.assertEqual(john[0], george)
|
||||
john.append('stuff')
|
||||
self.assertEqual(john.list, ['John', 'Adams', 90, 'stuff'])
|
||||
|
||||
def test_row_contains(self):
|
||||
"""Row __contains__."""
|
||||
|
||||
Reference in New Issue
Block a user