def test_should_read_description(self): reader = PackageReader() expected_description = {'Suggests': 'randomForest, e1071', 'Depends': 'R (>= 2.15.0), xtable, pbapply', 'Version': '0.9.2', 'License': 'GPL (>= 2)', 'Package': 'A3', 'NeedsCompilation': False} description = reader.read_description("Package: A3\nVersion: 0.9.2\nDepends: R (>= 2.15.0), xtable, pbapply\nSuggests: randomForest, e1071\nLicense: GPL (>= 2)\nNeedsCompilation: no") self.assertEqual(expected_description, description)
from cran_indexer import CranIndexer from package_reader import PackageReader package_reader = PackageReader() descriptions = package_reader.read("http://cran.r-project.org/src/contrib/PACKAGES") indexer = CranIndexer() for description in descriptions: indexer.index(description)