Interface needs a return value of the interface (the unittest)

Import unittest, Requests
 '' ' 
used when unittest framework, this interface requires a return value of the interface 
' '' 
class Test_case (of unittest.TestCase):
     DEF the setUp (Self):     # define global variables used Globals () function to the dictionary form 
        self.g = Globals () 
        self.s = requests.session ()   # Create the session () remain connected 
        Print ( ' start ' ) 

    DEF test_A (self):
         Print (self.g)
         # . 1 in response to an object request acquisition 
        self .g [ ' A ' ] = ' AAAAA '   #2 using regular expressions will result in response to match out into corpus variable 
        self.assertEqual (self.g [ ' A ' ], ' AAAAA ' ) 

    DEF Test_B (Self):
         Print (self.g) 
        self.g [ ' B ' ] = ' BBBBB ' 
        self.assertEqual (self.g [ ' B ' ], ' BBBBB ' ) 

    DEF test_c (Self):
         Print (self.g)
         # 1. Create the request parameters 
        C_A = self.g [ ' A ' ] 
        C_B= self.g['b']
        #2.发送请求

        self.assertEqual(c_a,'aaaaa')
        self.assertEqual(c_b,'bbbbb')

    def tearDown(self):
        print('结束')


if __name__ == '__main__':
    unittest.main(verbosity=2)

 

Guess you like

Origin www.cnblogs.com/tarzen213/p/11308277.html