Example #1
0
    def test_03_branch_rate(self):
        with tracing_import('./code/if_true_else', db=self.db) as module:
            pass
        xml = get_stats_xml(db=self.db, whitelist=[re.compile('.*')], blacklist=[])
        tree = etree.XML(xml)

        for i in tree.xpath('//class'):
            branch_rate = i.xpath("./@branch-rate")[0]
        self.assertXMLBranchRate(branch_rate)
Example #2
0
    def test_01_filename(self):
        with tracing_import('./code/if_true_else', db=self.db) as module:
            pass
        xml = get_stats_xml(db=self.db, whitelist=[re.compile('.*')], blacklist=[])
        tree = etree.XML(xml)

        for i in tree.xpath('//class'):
            filename = i.xpath("./@filename")[0]
        self.assertResultFileName(filename)
 def test_15_if_false_while_some(self):
     with tracing_import('if_false_while_some', db=self.db) as module:
         pass
     self.assertResultBranchRate(Rate(0, 2))     
 def test_12_if_true_for_some_ifelse(self):
     with tracing_import('if_true_for_some_ifelse', db=self.db) as module:
         pass
     self.assertResultBranchRate(Rate(2, 3))
 def test_45_true_false__function_value_if_value_else(self):
     with tracing_import('function_value_if_value_else', db=self.db) as module: 
         module.function(True); module.function(False)
     self.assertResultBranchRate(Rate(2, 2))
 def test_41_for_empty_if_true_if_false_not_nested(self):
     with tracing_import('for_empty_if_true_if_false_not_nested', db=self.db) as module:
         pass
     self.assertResultBranchRate(Rate(1, 3))
 def test_02_empty_file(self):
     with tracing_import('empty_file', db=self.db) as module:
         pass
     self.assertResultBranchRate(None)        
 def test_33_for_some_for_some(self):
     with tracing_import('for_some_for_some', db=self.db) as module:
         pass
     self.assertResultBranchRate(Rate(2, 2))
Example #9
0
 def test_14_if_false_while_some(self):
     with tracing_import('if_false_while_some', db=self.db) as module:
         pass
     self.assertResultLineRate(Rate(1, 4))     
Example #10
0
 def test_13_if_true_for_some_ifelse_for_some(self):
     with tracing_import('if_true_for_some_ifelse_for_some', db=self.db) as module:
         pass
     self.assertResultLineRate(Rate(3, 5))
Example #11
0
 def test_10_if_true_if_true_else(self):
     with tracing_import('if_true_if_true_else', db=self.db) as module:
         pass
     self.assertResultLineRate(Rate(3, 4))  
Example #12
0
 def test_08_if_true_if_false(self):
     with tracing_import('if_true_if_false', db=self.db) as module:
         pass
     self.assertResultLineRate(Rate(2, 5))        
Example #13
0
 def test_43_false_fucntion_value_if_value_else(self):
     with tracing_import('function_value_if_value_else', db=self.db) as module: 
         module.function(False)
     self.assertResultLineRate(Rate(3, 4))
Example #14
0
 def test_40_for_empty_if_true_if_false_not_nested(self):
     with tracing_import('for_empty_if_true_if_false_not_nested', db=self.db) as module:
         pass
     self.assertResultLineRate(Rate(4, 6))
Example #15
0
 def test_39_for_empty_break_else(self):
     with tracing_import('for_empty_break_else', db=self.db) as module:
         pass
     self.assertResultLineRate(Rate(2, 3))
 def test_28_while_some_while_some(self):
     with tracing_import('while_some_while_some', db=self.db) as module:
         pass
     self.assertResultBranchRate(Rate(2, 2))
 def test_31_for_empty(self):
     with tracing_import('for_empty', db=self.db) as module:
         pass
     self.assertResultBranchRate(Rate(0, 1))
Example #18
0
 def test_15_if_true_while_some_ifelse(self):
     with tracing_import('if_true_while_some_ifelse', db=self.db) as module:
         pass
     self.assertResultLineRate(Rate(4, 5))
 def test_37_for_some_while_false(self):
     with tracing_import('for_some_while_false', db=self.db) as module:
         pass
     self.assertResultBranchRate(Rate(1, 2))
Example #20
0
 def test_17_if_false_while_false_if_true_while_false(self):
     with tracing_import('if_false_while_false_if_true_while_false', db=self.db) as module:
         pass
     self.assertResultLineRate(Rate(3, 6)) 
 def test_40_for_empty_break_else(self):
     with tracing_import('for_empty_break_else', db=self.db) as module:
         pass
     self.assertResultBranchRate(Rate(1, 2))
Example #22
0
 def test_18_while_some(self):
     with tracing_import('while_some', db=self.db) as module:
         pass
     self.assertResultLineRate(Rate(3, 3))        
 def test_42_true_true_true_false__function_a_b_if_a_if_b_else(self):
     with tracing_import('function_a_b_if_a_if_b_else', db=self.db) as module:
         module.function(True, True); module.function(True, False)
     self.assertResultBranchRate(Rate(3, 3))
 def test_01_no_branch(self):
     with tracing_import('no_branch', db=self.db) as module:
         pass
     self.assertResultBranchRate(None)
 def test_09_if_false_if_true_else(self):
     with tracing_import('if_false_if_true_else', db=self.db) as module:
         pass
     self.assertResultBranchRate(Rate(0, 3))
 def test_20_while_false(self):
     with tracing_import('while_false', db=self.db) as module:
         pass
     self.assertResultBranchRate(Rate(0, 1))          
 def test_14_if_false_for_some_ifelse_for_some(self):
     with tracing_import('if_false_for_some_ifelse_for_some', db=self.db) as module:
         pass
     self.assertResultBranchRate(Rate(2, 4))
 def test_25_while_false_for_some(self):
     with tracing_import('while_false_for_some', db=self.db) as module:
         pass
     self.assertResultBranchRate(Rate(0, 3))
 def test_17_if_true_while_false_ifelse(self):
     with tracing_import('if_true_while_false_ifelse', db=self.db) as module:
         pass
     self.assertResultBranchRate(Rate(1, 3))    
 def test_01_no_branch(self):
     with tracing_import('no_branch', db=self.db) as module:
         pass
     self.assertResultLineRate(Rate(3, 3))