Skip to content

Commit

Permalink
fixes test for issue 111
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangFahl committed Nov 8, 2024
1 parent b10afc1 commit 4a4ab2d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions tests/test_wikiquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@author: wf
"""

import re
import json
import unittest
from contextlib import redirect_stdout
Expand Down Expand Up @@ -191,10 +191,16 @@ def test_issue111(self):
mystdout = StringIO()
with redirect_stdout(mystdout):
mainQuery(argv)
res = mystdout.getvalue()
if self.debug:
print(res)
records=json.loads(res)
text = mystdout.getvalue()
debug=self.debug
#debug=True
json_text = re.search(r'\{.*', text, re.DOTALL).group(0)
if debug:
print(json_text)
records=json.loads(json_text)
self.assertGreaterEqual(len(records["data"]),3)
for record in records["data"]:
self.assertIn("name", record)
pass


Expand Down

0 comments on commit 4a4ab2d

Please sign in to comment.