"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/test_googler.py" between
googler-4.3.1.tar.gz and googler-4.3.2.tar.gz

About: googler is a command line tool to search Google (Web & News) from the terminal (requires Python).

test_googler.py  (googler-4.3.1):test_googler.py  (googler-4.3.2)
skipping to change at line 20 skipping to change at line 20
GOOGLER = ROOT / "googler" GOOGLER = ROOT / "googler"
# Load preset options from the environment, in case the testing # Load preset options from the environment, in case the testing
# environment need options like --ipv4 or --proxy to connect. # environment need options like --ipv4 or --proxy to connect.
PRESET_OPTIONS = os.getenv("GOOGLER_PRESET_OPTIONS", "").split() PRESET_OPTIONS = os.getenv("GOOGLER_PRESET_OPTIONS", "").split()
class GooglerResults: class GooglerResults:
def __init__(self, argv): def __init__(self, argv):
self.argv = argv self.argv = argv
json_output = subprocess.check_output( json_output = subprocess.check_output(
[str(GOOGLER), *PRESET_OPTIONS, "--json", *argv] [str(GOOGLER), *PRESET_OPTIONS, "--debug", "--json", *argv]
).decode("utf-8") ).decode("utf-8")
self.results = json.loads(json_output) self.results = json.loads(json_output)
assert self.results, "no results" assert self.results, "no results"
def all_should(self, predicate): def all_should(self, predicate):
# Using a loop for better error reporting. # Using a loop for better error reporting.
for result in self.results: for result in self.results:
assert predicate(result) assert predicate(result)
def some_should(self, predicate): def some_should(self, predicate):
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)