From 8ca6abe5159c395518885a8c590cc1af17edcb6b Mon Sep 17 00:00:00 2001 From: Joscha Schmiedt <joscha@schmiedt.dev> Date: Mon, 26 Feb 2024 12:32:27 +0100 Subject: [PATCH] Add failing test for continer slicing --- unittests/test_container.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/unittests/test_container.py b/unittests/test_container.py index 4cd8fefc..026f6424 100644 --- a/unittests/test_container.py +++ b/unittests/test_container.py @@ -178,3 +178,13 @@ def test_container_deletion_with_references(): assert len(deps14a) == 1 and deps14a.pop() == -1 assert len(deps14b) == 1 and deps14b.pop() == -1 assert len(deps15) == 1 and deps15.pop() == -1 + + +def test_container_slicing(): + cont = db.Container() + cont.extend([db.Record(name=f"TestRec{ii+1}") for ii in range(5)]) + assert isinstance(cont, db.common.models.Container) + container_slice = cont[:2] + assert isinstance(container_slice, db.common.models.Container), \ + f"Container slice should be Container, was {type(container_slice)}" + # cont[:2].retrieve() -- GitLab