Skip to content

Commit

Permalink
add tests to cover cases when add/remove nothing
Browse files Browse the repository at this point in the history
  • Loading branch information
rabbull committed Jan 21, 2025
1 parent 0360df3 commit c2a18f0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/orm/test_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ def test_add_nodes(self):
group.add_nodes(node_01)
assert set(_.pk for _ in nodes) == set(_.pk for _ in group.nodes)

# Try to add nothing: there should be no problem
group.add_nodes([])
assert set(_.pk for _ in nodes) == set(_.pk for _ in group.nodes)


def test_remove_nodes(self):
"""Test node removal."""
node_01 = orm.Data().store()
Expand Down Expand Up @@ -177,6 +182,11 @@ def test_remove_nodes(self):
group.remove_nodes([node_01, node_02])
assert set(_.pk for _ in nodes) == set(_.pk for _ in group.nodes)

# Try to remove nothing: there should be no problem
group.remove_nodes([])
assert set(_.pk for _ in nodes) == set(_.pk for _ in group.nodes)


def test_clear(self):
"""Test the `clear` method to remove all nodes."""
node_01 = orm.Data().store()
Expand Down

0 comments on commit c2a18f0

Please sign in to comment.