예제 #1
0
 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))
예제 #2
0
 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())
예제 #3
0
 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)))
예제 #4
0
    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)
예제 #5
0
    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)
예제 #6
0
    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)
예제 #7
0
 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)
예제 #8
0
 def test_str(self):
     self.assertEqual('foo-1.2.3-1', str(PD('foo', '1.2.3-1')))
예제 #9
0
 def test_tarball_filename(self):
     self.assertEqual('foo-1.2.3-1.tar.gz',
                      PD('foo', '1.2.3-1').tarball_filename)
예제 #10
0
 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)))
예제 #11
0
 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'))
예제 #12
0
 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())
예제 #13
0
 def test_parse_string(self):
     self.assertEqual(PD('foo', '1.2.3-1'), PD.parse('foo-1.2.3-1'))
예제 #14
0
 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))
예제 #15
0
 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)
예제 #16
0
 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)))
예제 #17
0
 def test_full_name(self):
     self.assertEqual('foo-1.2.3-1', PD('foo', '1.2.3-1', []).full_name)