Commits

Tuk Bredsdorff committed 76b98a6

Return None instead of False from doc finder functions.

  • Participants
  • Parent commits 6e546f5

Comments (0)

Files changed (2)

Support/doc_finder.py

 			return html_snip
 	except IOError, e:
 		print(filepath, e)
-		return False
+		return None
 
 
 def gen_method_html(name, html):
 		flags=re.S
 	)
 	
-	res = regsearch.group()
-	
-	if res:
+	if regsearch:
+		res = regsearch.group()
 		files_and_ids = re.findall(r'href="(.+?)#(.+?)"', res, flags=re.S)
 		return '</br></br>'.join(
 			method_html(*file_and_id_tuple) for file_and_id_tuple in files_and_ids
 		)
 	else:
-		return False
+		return None
 
 
 def find_docs(current_word):
 		except IOError, e:
 			print_error(path, e)
 	else:
-		return False
+		return None
 
 
 def method_info(name):
 			return gen_method_html(name, html)
 	except IOError, e:
 		print_error(methods_file, e)
-		return False
+		return None

Support/test_doc_finder.py

 
 def test_find_docs():
 	assert class_info('MOAILayer2D').find('MOAILayer2D Class Reference') != -1
-	assert class_info('XXX') == False
+	assert class_info('XXX') is None
 	assert mangle_name('MOAILayer2D') == 'class_m_o_a_i_layer2_d'
 	assert method_info('setViewport').find('Set the layer\'s viewport.') != -1
-	assert method_info('XXX') == False
+	assert method_info('XXX') is None
 	assert method_html(
 		'class_m_o_a_i_camera_fitter2_d.html',
 		'ae498f037a175858909a4b5cdb0a9d7de'
 	).find('Set the viewport to be used for fitting') != -1
-	assert method_html('XXX') == False
+	assert method_html('XXX', 'YYY') is None