Browse Source

Merge pull request #375 from gleitz/feature/sanity-check

An option for fixing the sanity check issue
Benjamin Gleitzman 3 years ago
parent
commit
982304247e
1 changed files with 5 additions and 2 deletions
  1. 5 2
      howdoi/howdoi.py

+ 5 - 2
howdoi/howdoi.py

@@ -649,11 +649,14 @@ def _sanity_check(engine, test_query=None):
     if not test_query:
         test_query = 'format date bash'
 
-    args = vars(parser.parse_args(('-j ' + test_query).split()))
+    args = vars(parser.parse_args(test_query.split()))
     args['search_engine'] = engine
 
     try:
-        assert isinstance(howdoi(args).encode('utf-8', 'ignore'), list)
+        result = howdoi(args)
+        # Perhaps better to use `-j` and then check for an error message
+        # rather than trying to enumerate all the error strings
+        assert "Sorry" not in result and "Unable to" not in result
     except AssertionError as exc:
         if engine == 'google':
             raise GoogleValidationError from exc