示例#1
0
    def test__yesno2bool_1(self):
        """yesno2bool(...)"""
        positives = ('y','yes','true','on','enable','enabled')
        negatives = ('n','no','false','off','disable','disabled')
        for p in positives:
            self.assertIs(tested.yesno2bool(p), True)
            self.assertIs(tested.yesno2bool(p.upper()), True)
        for n in negatives:
            self.assertIs(tested.yesno2bool(n), False)
            self.assertIs(tested.yesno2bool(n.upper()), False)

        self.assertIs(tested.yesno2bool('foo'), None)
示例#2
0
 def test__paths2list_5(self):
     """paths2list('"C:\windows":foo:bar') should == ['C:\windows', 'foo', 'bar']"""
     self.assertEqual(tested.paths2list('"C:\windows":foo:bar'), ['C:\windows', 'foo', 'bar'])
示例#3
0
 def test__build_iresubst_dict_1(self):
     """_build_iresubst_dict({}) should == {}"""
     self.assertEqual(tested._build_iresubst_dict({}),{})
示例#4
0
 def test__resubst_3(self):
     """_resubst('foo $bar', {'bar' : 'XBAR'}) should return 'foo XBAR'"""
     self.assertEqual(tested._resubst('foo $bar', {'bar' : 'XBAR'}), 'foo XBAR')
示例#5
0
 def test__resubst_1(self):
     """_resubst('foo bar') should return 'foo bar'"""
     self.assertEqual(tested._resubst('foo bar'), 'foo bar')
示例#6
0
 def test__cdefs2list_6(self):
     """cdefs2list("'-Dfoo=\"string with spaces\"' -Dother") should == ["-Dfoo=string with spaces"]"""
     self.assertEqual(tested.cdefs2list("'-Dfoo=\"string with spaces\"' -Dother"), ["-Dfoo=\"string with spaces\"", '-Dother'])
示例#7
0
 def test__cdefs2list_4(self):
     """cdefs2list('-Dfoo="string with spaces"') should == ['-Dfoo=string with spaces']"""
     self.assertEqual(tested.cdefs2list('-Dfoo="string with spaces"'), ['-Dfoo=string with spaces'])
示例#8
0
 def test__cdefs2list_2(self):
     """cdefs2list('-Dxyz') should == ['-Dxyz']"""
     self.assertEqual(tested.cdefs2list('-Dxyz'),['-Dxyz'])
示例#9
0
 def test__invert_dict_3(self):
     """_invert_dict({ 'v' : 'w', 'x' : 'y' }) should == { 'w' : 'v', 'y' : 'x'}"""
     self.assertEqual(tested._invert_dict({'v' : 'w', 'x' : 'y'}), { 'w' : 'v', 'y' : 'x'})
示例#10
0
 def test__invert_dict_2(self):
     """_invert_dict({ 'x' : 'y' }) should == { 'y' : 'x'}"""
     self.assertEqual(tested._invert_dict({'x' : 'y'}), { 'y' : 'x'})
示例#11
0
 def test__invert_dict_1(self):
     """_invert_dict({}) should == {}"""
     self.assertEqual(tested._invert_dict({}), {})
示例#12
0
 def test__compose_mappings_2(self):
     """_compose_mappings({'uuu' : 'vvv', 'xxx' : 'yyy'} ,{ 'vvv' : 'VVV', 'yyy' : 'YYY'}) should == {'uuu' : 'VVV'}"""
     self.assertEqual(tested._compose_mappings({'uuu' : 'vvv', 'xxx' : 'yyy'}, { 'vvv' : 'VVV', 'yyy' : 'YYY'}), {'uuu' : 'VVV', 'xxx' : 'YYY'})
示例#13
0
 def test__compose_mappings_1(self):
     """_compose_mappings({},{}) should == {}"""
     self.assertEqual(tested._compose_mappings({},{}),{})
示例#14
0
 def test__build_iresubst_dict_2(self):
     """_build_iresubst_dict({'xxx' : 'yyy', 'vvv' : 'www'}) should == {'yyy' : '${xxx}', 'www' : '${vvv}'}"""
     self.assertEqual(tested._build_iresubst_dict({'xxx' : 'yyy', 'vvv' : 'www'}), {'yyy' : '${xxx}', 'www' : '${vvv}'})
示例#15
0
 def test__cdefs2list_0(self):
     """cdefs2list('') should be an instance of SCons.Util.CLVar"""
     self.assertIsInstance(tested.cdefs2list(''), SCons.Util.CLVar)
示例#16
0
 def test__cdefs2list_1(self):
     """cdefs2list('') should == []"""
     self.assertEqual(tested.cdefs2list(''),[])
示例#17
0
 def test__flags2list_1(self):
     """flags2list('') should == []"""
     self.assertEqual(tested.flags2list(''),[])
示例#18
0
 def test__cdefs2list_3(self):
     """cdefs2list('-Dfoo -Dbar') should == ['-Dfoo', '-Dbar']"""
     self.assertEqual(tested.cdefs2list('-Dfoo -Dbar'), ['-Dfoo', '-Dbar'])
示例#19
0
 def test__flags2list_2(self):
     """flags2list('xyz') should == ['xyz']"""
     self.assertEqual(tested.flags2list('xyz'),['xyz'])
示例#20
0
 def test__cdefs2list_5(self):
     """cdefs2list("-Dfoo='string with spaces'") should == ["-Dfoo=string with spaces"]"""
     self.assertEqual(tested.cdefs2list("-Dfoo='string with spaces'"), ["-Dfoo=string with spaces"])
示例#21
0
 def test__flags2list_3(self):
     """flags2list('foo bar') should == ['foo', 'bar']"""
     self.assertEqual(tested.flags2list('foo bar'), ['foo', 'bar'])
示例#22
0
 def test__paths2list_1(self):
     """paths2list('') should == []"""
     self.assertEqual(tested.paths2list(''),[])
示例#23
0
 def test__paths2list_2(self):
     """paths2list('xyz') should == ['xyz']"""
     self.assertEqual(tested.paths2list('xyz'),['xyz'])
示例#24
0
 def test__resubst_2(self):
     """_resubst('foo bar', {'foo' : 'XFOO'}) should return 'foo bar'"""
     self.assertEqual(tested._resubst('foo bar', {'foo' : 'XFOO'}), 'foo bar')
示例#25
0
 def test__paths2list_4(self):
     """paths2list('foo:bar') should == ['foo', 'bar']"""
     self.assertEqual(tested.paths2list('foo:bar'), ['foo', 'bar'])
示例#26
0
 def test__resubst_5(self):
     """_resubst('$foo $bar', {'foo' : '$bar', 'bar' : 'XBAR'}) should return '$bar XBAR'"""
     self.assertEqual(tested._resubst('$foo $bar', {'foo' : '$bar', 'bar' : 'XBAR'}), '$bar XBAR')
示例#27
0
 def test__resubst_8(self):
     """_resubst('${foo} ${bar}', {'foo' : '${bar}', 'bar' : 'XBAR'}) should return '${bar} XBAR'"""
     self.assertEqual(tested._resubst('${foo} ${bar}', {'foo' : '${bar}', 'bar' : 'XBAR'}), '${bar} XBAR')