1616class BaseDocsFunctionalTests (unittest .TestCase ):
1717 def assert_contains_lines_in_order (self , lines , contents ):
1818 for line in lines :
19- self . assertIn ( line , contents )
19+ assert line in contents
2020 beginning = contents .find (line )
2121 contents = contents [(beginning + len (line )):]
2222
2323 def get_class_document_block (self , class_name , contents ):
2424 start_class_document = '.. py:class:: %s' % class_name
2525 start_index = contents .find (start_class_document )
26- self . assertNotEqual ( start_index , - 1 , 'Class is not found in contents' )
26+ assert start_index != - 1 , 'Class is not found in contents'
2727 contents = contents [start_index :]
2828 end_index = contents .find (
2929 ' .. py:class::' , len (start_class_document ))
@@ -32,7 +32,7 @@ def get_class_document_block(self, class_name, contents):
3232 def get_method_document_block (self , method_name , contents ):
3333 start_method_document = ' .. py:method:: %s(' % method_name
3434 start_index = contents .find (start_method_document )
35- self . assertNotEqual ( start_index , - 1 , 'Method is not found in contents' )
35+ assert start_index != - 1 , 'Method is not found in contents'
3636 contents = contents [start_index :]
3737 end_index = contents .find (
3838 ' .. py:method::' , len (start_method_document ))
@@ -41,8 +41,7 @@ def get_method_document_block(self, method_name, contents):
4141 def get_request_syntax_document_block (self , contents ):
4242 start_marker = '**Request Syntax**'
4343 start_index = contents .find (start_marker )
44- self .assertNotEqual (
45- start_index , - 1 , 'There is no request syntax section' )
44+ assert start_index != - 1 , 'There is no request syntax section'
4645 contents = contents [start_index :]
4746 end_index = contents .find (
4847 ':type' , len (start_marker ))
@@ -51,8 +50,7 @@ def get_request_syntax_document_block(self, contents):
5150 def get_response_syntax_document_block (self , contents ):
5251 start_marker = '**Response Syntax**'
5352 start_index = contents .find (start_marker )
54- self .assertNotEqual (
55- start_index , - 1 , 'There is no response syntax section' )
53+ assert start_index != - 1 , 'There is no response syntax section'
5654 contents = contents [start_index :]
5755 end_index = contents .find (
5856 '**Response Structure**' , len (start_marker ))
@@ -61,19 +59,19 @@ def get_response_syntax_document_block(self, contents):
6159 def get_request_parameter_document_block (self , param_name , contents ):
6260 start_param_document = ':type %s:' % param_name
6361 start_index = contents .find (start_param_document )
64- self . assertNotEqual ( start_index , - 1 , 'Param is not found in contents' )
62+ assert start_index != - 1 , 'Param is not found in contents'
6563 contents = contents [start_index :]
6664 end_index = contents .find (':type' , len (start_param_document ))
6765 return contents [:end_index ]
6866
6967 def get_response_parameter_document_block (self , param_name , contents ):
7068 start_param_document = '**Response Structure**'
7169 start_index = contents .find (start_param_document )
72- self . assertNotEqual ( start_index , - 1 , 'There is no response structure' )
70+ assert start_index != - 1 , 'There is no response structure'
7371
7472 start_param_document = '- **%s**' % param_name
7573 start_index = contents .find (start_param_document )
76- self . assertNotEqual ( start_index , - 1 , 'Param is not found in contents' )
74+ assert start_index != - 1 , 'Param is not found in contents'
7775 contents = contents [start_index :]
7876 end_index = contents .find ('- **' , len (start_param_document ))
7977 return contents [:end_index ]
0 commit comments