def test_items_iterable(self, items): collection = IdentifiedCollection() if isinstance(items, dict): items[1] = TestIdentifiedCollection.IdentifiedMock(1) else: items.append(TestIdentifiedCollection.IdentifiedMock(1)) collection.items = items assert isinstance(collection.items, list) assert len(collection.items) == len(items)
def test_items_none(self): collection = IdentifiedCollection(None) collection.items = None assert collection.items is not None assert isinstance(collection.items, list)
def test_items_iterable_invalid(self, items): collection = IdentifiedCollection() with pytest.raises((TypeError, ValueError)): collection.items = items