def assert_urls(host_blocker, blocked=BLOCKLIST_HOSTS, whitelisted=WHITELISTED_HOSTS, urls_to_check=URLS_TO_CHECK):
 whitelisted = (list(whitelisted) + list(host_blocker.WHITELISTED))
 for str_url in urls_to_check:
  url = QUrl(str_url)
  host = url.host()
  if ((host in blocked) and (host not in whitelisted)):
   assert host_blocker.is_blocked(url)
  else:
   assert (not host_blocker.is_blocked(url))

def assert_urls ( host_blocker , blocked = BLOCKLIST_HOSTS , whitelisted = WHITELISTED_HOSTS , urls_to_check = URLS_TO_CHECK ) : whitelisted = ( list ( whitelisted ) + list ( host_blocker . WHITELISTED ) ) for str_url in urls_to_check : url = QUrl ( str_url ) host = url . host ( ) if ( ( host in blocked ) and ( host not in whitelisted ) ) : assert host_blocker . is_blocked ( url ) else : assert ( not host_blocker . is_blocked ( url ) )
test if urls to check are blocked or not by hostblocker .