@flake8ext
def check_assertisinstance(logical_line, filename):
 if ('neutron/tests/' in filename):
  if re.search('assertTrue\\(\\s*isinstance\\(\\s*[^,]*,\\s*[^,]*\\)\\)', logical_line):
   msg = 'N331: Use assertIsInstance(observed, type) instead of assertTrue(isinstance(observed, type))'
   (yield (0, msg))

@ flake8ext def check_assertisinstance ( logical_line , filename ) : if ( 'neutron/tests/' in filename ) : if re . search ( 'assertTrue\\(\\s*isinstance\\(\\s*[^,]*,\\s*[^,]*\\)\\)' , logical_line ) : msg = 'N331: Use assertIsInstance(observed, type) instead of assertTrue(isinstance(observed, type))' ( yield ( 0 , msg ) )
n331 - enforce using assertisinstance .