Skip to content

Commit

Permalink
add release notes, test coverage, and example in updates.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
jpinner-lyft committed Sep 10, 2020
1 parent 787104d commit 43d28d8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/release_notes.rst
Expand Up @@ -10,6 +10,7 @@ v5.0 (unreleased)
"'filter_condition' cannot contain key attributes" errors.
* Replace the internal attribute type constants with their "short" DynamoDB version (#827)
* Typed list attributes can now support any Attribute subclass (#833)
* Remove ``ListAttribute.remove_indexes`` (added in v4.3.2) and document usage of remove for list elements (#838)

v4.3.3
----------
Expand Down
2 changes: 1 addition & 1 deletion docs/updates.rst
Expand Up @@ -37,7 +37,7 @@ Any value provided will be serialized using the serializer defined for that attr
:header: DynamoDB Action / Operator, PynamoDB Syntax, Example

SET, set( `value` ), Thread.views.set(10)
REMOVE, remove(), Thread.subjects.remove()
REMOVE, remove(), Thread.notes[0].remove()
ADD, add( `value` ), "Thread.subjects.add({'A New Subject', 'Another New Subject'})"
DELETE, delete( `value` ), Thread.subjects.delete({'An Old Subject'})
`attr_or_value_1` \+ `attr_or_value_2`, `attr_or_value_1` \+ `attr_or_value_2`, Thread.views + 5
Expand Down
9 changes: 9 additions & 0 deletions tests/test_expressions.py
Expand Up @@ -431,6 +431,7 @@ class UpdateExpressionTestCase(TestCase):

def setUp(self):
self.attribute = UnicodeAttribute(attr_name='foo')
self.list_attribute = ListAttribute(attr_name='foo_list')

def test_set_action(self):
action = self.attribute.set('bar')
Expand Down Expand Up @@ -517,6 +518,14 @@ def test_remove_action(self):
assert placeholder_names == {'foo': '#0'}
assert expression_attribute_values == {}

def test_remove_action_list_element(self):
action = self.list_attribute[10].remove()
placeholder_names, expression_attribute_values = {}, {}
expression = action.serialize(placeholder_names, expression_attribute_values)
assert expression == "#0[10]"
assert placeholder_names == {'foo_list': '#0'}
assert expression_attribute_values == {}

def test_add_action(self):
action = Path('foo').add(0)
placeholder_names, expression_attribute_values = {}, {}
Expand Down

0 comments on commit 43d28d8

Please sign in to comment.