Esempio n. 1
0
 def test_to_string(self):
     reqs = RL([
         R('foo', '>=', '1.2.3'),
         R('orange', '>=', '6.6.6'),
         R('bar', None, None),
         R('baz', None, None)
     ])
     self.assertEqual('foo >= 1.2.3 orange >= 6.6.6 bar baz', str(reqs))
Esempio n. 2
0
 def test_to_string_with_system(self):
     reqs = RL([
         R('foo', '>=', '1.2.3', 'macos'),
         R('orange', '>=', '6.6.6', 'all'),
         R('bar', None, None, 'desktop'),
         R('baz', None, None, 'linux')
     ])
     self.assertEqual(
         'foo(macos) >= 1.2.3 orange >= 6.6.6 bar(desktop) baz(linux)',
         str(reqs))
Esempio n. 3
0
    def test_dups(self):
        reqs = RL([
            R('kiwi', None, None),
            R('orange', None, None),
            R('apple', None, None)
        ])
        self.assertEqual([], reqs.dups())

        reqs = RL([
            R('kiwi', None, None),
            R('kiwi', None, None),
            R('orange', None, None),
            R('apple', None, None)
        ])
        self.assertEqual(['kiwi'], reqs.dups())
Esempio n. 4
0
 def test___str__(self):
   self.assertEqual( 'foo >= 1.2.3', str(R('foo', '>=', '1.2.3')) )
   self.assertEqual( 'orange >= 6.6.6', str(R('orange', '>=', '6.6.6')) )
Esempio n. 5
0
 def test_system_mask_matches(self):
   self.assertTrue( R('foo', '>=', '1.2.3', 'linux', None).system_mask_matches('linux') )
   self.assertFalse( R('foo', '>=', '1.2.3', 'linux', None).system_mask_matches('macos') )
   self.assertTrue( R('foo', '>=', '1.2.3', 'all', None).system_mask_matches('linux') )
   self.assertTrue( R('foo', '>=', '1.2.3', 'all', None).system_mask_matches('macos') )
Esempio n. 6
0
 def test_hardness_matches_seq(self):
   self.assertTrue( R('foo', '>=', '1.2.3', 'linux', 'RUN').hardness_matches([ 'RUN', 'TOOL']) )
   self.assertTrue( R('foo', '>=', '1.2.3', 'linux', 'TOOL').hardness_matches([ 'RUN', 'TOOL']) )
   self.assertTrue( R('foo', '>=', '1.2.3', 'linux', None).hardness_matches([ 'RUN', 'TOOL']) )
Esempio n. 7
0
 def test_hardness_matches(self):
   self.assertTrue( R('foo', '>=', '1.2.3', 'linux', 'RUN').hardness_matches('RUN') )
   self.assertFalse( R('foo', '>=', '1.2.3', 'linux', 'RUN').hardness_matches('TOOL') )
   self.assertTrue( R('foo', '>=', '1.2.3', 'linux', None).hardness_matches('RUN') )
Esempio n. 8
0
 def test_clone_replace_system_mask(self):
   r1 = R('foo', '>=', '1.2.3', 'linux', 'RUN')
   r2 = r1.clone_replace_system_mask('macos')
   self.assertEqual( 'linux', str(r1.system_mask) )
   self.assertEqual( 'macos', str(r2.system_mask) )
Esempio n. 9
0
 def test_clone_replace_hardness(self):
   r1 = R('foo', '>=', '1.2.3', 'linux', 'RUN')
   r2 = r1.clone_replace_hardness('BUILD')
   self.assertEqual( 'RUN', r1.hardness.name )
   self.assertEqual( 'BUILD', r2.hardness.name )
Esempio n. 10
0
 def test___str__with_hardness(self):
   self.assertEqual( 'RUN foo(linux) >= 1.2.3', str(R('foo', '>=', '1.2.3', 'linux', 'RUN')) )
Esempio n. 11
0
 def test_to_string_colon_format_with_expression(self):
   self.assertEqual( 'all(${FOO} < 99): RUN foo >= 1.2.3', R('foo', '>=', '1.2.3', None, 'RUN', '${FOO} < 99').to_string_colon_format() )
Esempio n. 12
0
 def test_to_string_colon_format_with_hardness(self):
   self.assertEqual( 'all: RUN foo >= 1.2.3', R('foo', '>=', '1.2.3', None, 'RUN').to_string_colon_format() )
   self.assertEqual( 'linux: TOOL foo >= 1.2.3', R('foo', '>=', '1.2.3', 'linux', 'TOOL').to_string_colon_format() )
Esempio n. 13
0
 def test_to_string_colon_format(self):
   self.assertEqual( 'all: foo >= 1.2.3', R('foo', '>=', '1.2.3', None).to_string_colon_format() )
   self.assertEqual( 'linux: foo >= 1.2.3', R('foo', '>=', '1.2.3', 'linux').to_string_colon_format() )
Esempio n. 14
0
 def test___str__with_system(self):
   self.assertEqual( 'foo(linux) >= 1.2.3', str(R('foo', '>=', '1.2.3', 'linux')) )
   self.assertEqual( 'orange >= 6.6.6', str(R('orange', '>=', '6.6.6', 'all')) )