def test___str__(self): l = PDL([ PD('foo', '1.2.3-1'), PD('bar', '4.5.6'), PD('baz', '7.8.9'), ]) self.assertEqual('foo-1.2.3-1\nbar-4.5.6\nbaz-7.8.9', str(l))
def test_names(self): l = PDL([ PD('foo', '1.2.3-1'), PD('bar', '4.5.6'), PD('baz', '7.8.9'), ]) self.assertEqual(['foo', 'bar', 'baz'], l.names())
def test_str_with_requirements_and_properties(self): self.assertEqual( 'foo-1.2.3-1(d1 >= 1.2.3-1 d2 >= 6.6.6-1; a=5; b=66)', str( PD('foo', '1.2.3-1', requirements=self.TEST_REQUIREMENTS, properties=self.TEST_PROPS)))
def test_parse_json_null_requirements(self): json = '''\ { "version": "1.2.3-1", "name": "foo", "requirements": null }''' expected_info = PD('foo', '1.2.3-1') actual_info = PD.parse_json(json) self.assertEqual(expected_info, actual_info)
def test_parse_json(self): json = '''\ { "version": "1.2.3-1", "name": "foo", "requirements": [ "all: d1 >= 1.2.3-1", "all: d2 >= 6.6.6-1" ] }''' expected_info = PD('foo', '1.2.3-1', requirements=self.TEST_REQUIREMENTS) actual_info = PD.parse_json(json) self.assertEqual(expected_info, actual_info)
def test_to_json(self): self.maxDiff = None expected_json = '''\ { "name": "foo", "properties": {}, "requirements": [ "all: d1 >= 1.2.3-1", "all: d2 >= 6.6.6-1" ], "version": "1.2.3-1" }''' pi = PD('foo', '1.2.3-1', requirements=self.TEST_REQUIREMENTS) actual_json = pi.to_json() self.assertEqualIgnoreWhiteSpace(expected_json, actual_json)
def test___eq__(self): l1 = PDL([ PD('foo', '1.2.3-1'), PD('bar', '4.5.6'), PD('baz', '7.8.9'), ]) l2 = PDL([ PD('foo', '1.2.3-1'), PD('bar', '4.5.6'), PD('baz', '7.8.9'), ]) self.assertEqual(l1, l2)
def test_str(self): self.assertEqual('foo-1.2.3-1', str(PD('foo', '1.2.3-1')))
def test_tarball_filename(self): self.assertEqual('foo-1.2.3-1.tar.gz', PD('foo', '1.2.3-1').tarball_filename)
def test_str_with_properties(self): self.assertEqual('foo-1.2.3-1(a=5; b=66)', str(PD('foo', '1.2.3-1', properties=self.TEST_PROPS)))
def test_lt(self): self.assertTrue(PD('foo', '1.2.3-1') < PD('foo', '1.2.3-2')) self.assertTrue(PD('foo', '1.2.3-2') < PD('foo', '1.2.4-1')) self.assertTrue(PD('foo', '1.2.3-1') < PD('foo', '1.2.4.5-1'))
def test_properties_to_string(self): self.assertEqual( 'a=5; b=66', PD('foo', '1.2.3-1', properties=self.TEST_PROPS).properties_to_string())
def test_parse_string(self): self.assertEqual(PD('foo', '1.2.3-1'), PD.parse('foo-1.2.3-1'))
def xtest_artifact_path(self): self.assertEqual( 'macos/x86_64/release/foo-1.2.3-1.tar.gz', PD('foo', '1.2.3-1').artifact_path(self.BT_MACOS_RELEASE))
def test_init(self): self.assertEqual('foo-1.2.3-1', PD('foo', '1.2.3-1', []).full_name) self.assertEqual('foo-1.2.3-1', PD('foo', '1.2.3-1', None).full_name) self.assertEqual('foo-1.2.3-1', PD('foo', '1.2.3-1').full_name)
def test_str_with_requirements(self): self.assertEqual( 'foo-1.2.3-1(d1 >= 1.2.3-1 d2 >= 6.6.6-1)', str(PD('foo', '1.2.3-1', requirements=self.TEST_REQUIREMENTS)))
def test_full_name(self): self.assertEqual('foo-1.2.3-1', PD('foo', '1.2.3-1', []).full_name)