def test_multiple_manifest_multiple_dep(self):
     """Test multiple manifest with multiple deps."""
     collector = PypiCollector()
     collector.parse_and_collect(MANIFEST_START + DEP_1 + DEP_2, True)
     collector.parse_and_collect(MANIFEST_START + DEP_1 + DEP_2, True)
     packages = dict(collector.counter.most_common())
     assert packages == {'daiquiri, pydantic': 2}
    def _get_collector(self, ecosystem) -> BaseCollector:
        if ecosystem == 'maven':
            return MavenCollector()

        if ecosystem == 'npm':
            return NpmCollector()

        if ecosystem == 'pypi':
            return PypiCollector()
 def test_valid_and_empty_manifest(self):
     """Test a mix of empty and valid manifests."""
     collector = PypiCollector()
     collector.parse_and_collect(MANIFEST_START + DEP_1, True)
     collector.parse_and_collect(None, True)
     packages = dict(collector.counter.most_common())
     assert packages == {'daiquiri': 1}
 def test_multiple_manifest_with_single_dep(self):
     """Test muitple manifest with same deps."""
     collector = PypiCollector()
     collector.parse_and_collect(MANIFEST_START + DEP_1, True)
     collector.parse_and_collect(MANIFEST_START + DEP_1, True)
     collector.parse_and_collect(MANIFEST_START + DEP_1, True)
     packages = dict(collector.counter.most_common())
     assert packages == {'daiquiri': 3}
 def test_empty_manifest(self):
     """Test empty / invalid manifest."""
     collector = PypiCollector()
     collector.parse_and_collect(None, True)
     packages = dict(collector.counter.most_common())
     assert packages == {}
 def test_single_dep(self):
     """Test single dep."""
     collector = PypiCollector()
     collector.parse_and_collect(MANIFEST_START + DEP_1, True)
     packages = dict(collector.counter.most_common())
     assert packages == {'daiquiri': 1}