def test_str(self): self.assertEqual(str(Package.parse(' foo - 1.2 ')), 'foo-1.2.0') self.assertEqual( str(Package.parse(' foo - 1.2 ; depends bar >2,<3,>2.5')), 'foo-1.2.0;depends bar>2.5.0,<3.0.0') self.assertEqual( str(Package.parse(' foo - 1.2 ; depends bar >2,<3,>2.5; depends baz')), 'foo-1.2.0;depends bar>2.5.0,<3.0.0;depends baz')
def test_parse(self): p1 = Package.parse(' foo - 1.2 ') self.assertEqual(p1.name, 'foo') self.assertEqual(p1.version, '1.2.0') p2 = Package.parse(' foo - 1.2 ; depends bar >2,<3,>2.5; depends baz') self.assertTrue(Requirement.parse('bar >2,<3,>2.5') in p2.dependencies) self.assertTrue(Requirement.parse('baz') in p2.dependencies) self.assertEqual(len(p2.dependencies), 2)
def test(self): foo_repo = Repository(set([Package.parse("foo-1.0"), Package.parse("foo-2.0"), Package.parse("foo-3.0")])) vim_repo = Repository( set( [ Package.parse("vim-7.4+perl.python"), Package.parse("vim-7.4+perl.ruby.python"), Package.parse("vim-6.0+perl.ruby.python"), ] ) ) pool = Pool([foo_repo, vim_repo]) self.assertEqual( pool.get("foo"), [Package.parse("foo-1.0"), Package.parse("foo-2.0"), Package.parse("foo-3.0")] ) self.assertEqual(pool.get("vim[ruby]>7"), [Package.parse("vim-7.4+perl.ruby.python")]) self.assertEqual(pool.get(Requirement.parse("vim[ruby]>7")), [Package.parse("vim-7.4+perl.ruby.python")])
def test(self): packages = set([ Package.parse('foo-1.0'), Package.parse('foo-2.0'), Package.parse('foo-3.0'), Package.parse('vim-7.4+perl.python'), Package.parse('vim-7.4+perl.ruby.python'), Package.parse('vim-6.0+perl.ruby.python'), ]) repository = Repository(packages) self.assertEqual(repository.get('foo'), [ Package.parse('foo-1.0'), Package.parse('foo-2.0'), Package.parse('foo-3.0'), ]) self.assertEqual(repository.get('vim[ruby]>7'), [ Package.parse('vim-7.4+perl.ruby.python'), ])
def test(self): foo_repo = Repository(set([ Package.parse('foo-1.0'), Package.parse('foo-2.0'), Package.parse('foo-3.0')])) vim_repo = Repository(set([ Package.parse('vim-7.4+perl.python'), Package.parse('vim-7.4+perl.ruby.python'), Package.parse('vim-6.0+perl.ruby.python')])) pool = Pool([foo_repo, vim_repo]) self.assertEqual(pool.get('foo'), [ Package.parse('foo-1.0'), Package.parse('foo-2.0'), Package.parse('foo-3.0'), ]) self.assertEqual(pool.get('vim[ruby]>7'), [ Package.parse('vim-7.4+perl.ruby.python'), ])
def test(self): packages = set( [ Package.parse("foo-1.0"), Package.parse("foo-2.0"), Package.parse("foo-3.0"), Package.parse("vim-7.4+perl.python"), Package.parse("vim-7.4+perl.ruby.python"), Package.parse("vim-6.0+perl.ruby.python"), ] ) repository = Repository(packages) self.assertEqual( repository.get("foo"), [Package.parse("foo-1.0"), Package.parse("foo-2.0"), Package.parse("foo-3.0")] ) self.assertEqual(repository.get("vim[ruby]>7"), [Package.parse("vim-7.4+perl.ruby.python")])
def test(self): foo_repo = Repository( set([ Package.parse('foo-1.0'), Package.parse('foo-2.0'), Package.parse('foo-3.0') ])) vim_repo = Repository( set([ Package.parse('vim-7.4+perl.python'), Package.parse('vim-7.4+perl.ruby.python'), Package.parse('vim-6.0+perl.ruby.python') ])) pool = Pool([foo_repo, vim_repo]) self.assertEqual(pool.get('foo'), [ Package.parse('foo-1.0'), Package.parse('foo-2.0'), Package.parse('foo-3.0'), ]) self.assertEqual(pool.get('vim[ruby]>7'), [ Package.parse('vim-7.4+perl.ruby.python'), ]) self.assertEqual(pool.get(Requirement.parse('vim[ruby]>7')), [ Package.parse('vim-7.4+perl.ruby.python'), ])
def test_upgrade_requirement(self): self.assertEqual(Package.parse('foo-1').upgrade_requirement, 'foo>1')
def test_ne(self): self.assertTrue(Package.parse('foo-1') != 'foo-2') self.assertFalse(Package.parse('foo-1') != 'foo-1') self.assertTrue(Package.parse('foo-1') != 'bar-2') self.assertTrue(Package.parse('foo-1+bar') != 'foo-1+baz') self.assertFalse(Package.parse('foo-1+bar') != 'foo-1+bar')
def test_build_options(self): self.assertEqual(Package.parse('foo-1+foo.bar').build_options, set(['bar', 'foo']))
def test_lt(self): self.assertTrue(Package.parse('bar-1') < Package.parse('foo-0.1')) self.assertTrue(Package.parse('foo-1') < Package.parse('foo-2')) self.assertFalse(Package.parse('foo-2') < Package.parse('foo-2')) self.assertFalse(Package.parse('foo-3') < Package.parse('foo-2'))
def test_repr(self): self.assertEqual(repr(Package.parse('foo-1')), "Package.parse('foo-1.0.0')")