def test_to_filename(self): m1 = MatchSpec(fn='foo-1.7-52.tar.bz2') m2 = MatchSpec(name='foo', version='1.7', build='52') m3 = MatchSpec(Dist('defaults::foo-1.7-52')) assert m1.to_filename() == 'foo-1.7-52.tar.bz2' assert m2.to_filename() == 'foo-1.7-52.tar.bz2' assert m3.to_filename() == 'foo-1.7-52.tar.bz2' for spec in 'bitarray', 'pycosat 0.6.0', 'numpy 1.6*': ms = MatchSpec(spec) assert ms.to_filename() is None
def test_build_number_and_filename(self): ms = MatchSpec('zlib 1.2.7 0') assert ms.exact_field('name') == 'zlib' assert ms.exact_field('version') == '1.2.7' assert ms.exact_field('build') == '0' assert ms.to_filename() == 'zlib-1.2.7-0.tar.bz2'