def test_get_parts_by_content_type(self): pack = Package() part = SamplePart(pack, '/pmx/samp.main') pack.add(part) parts = pack.get_parts_by_content_type(part.content_type) assert next(parts) is part with pytest.raises(StopIteration): next(parts) ct = pack.content_types.find_for(part.name) parts = pack.get_parts_by_content_type(ct) assert next(parts) is part with pytest.raises(StopIteration): next(parts)