Restore prior expectation about Pod.text

This commit is contained in:
Jason R. Coombs 2016-09-03 12:24:46 -04:00
parent b69b312692
commit 14ba338b1e
2 changed files with 7 additions and 3 deletions

View File

@ -140,12 +140,16 @@ class Pod(ErrorHandler, object):
return self.number_of_subpods return self.number_of_subpods
@property @property
def text(self): def texts(self):
""" """
Simply get the text from each subpod in this pod and return it in a list. The text from each subpod in this pod as a list.
""" """
return [subpod.text for subpod in self.subpods] return [subpod.text for subpod in self.subpods]
@property
def text(self):
return next(iter(self)).text
class Subpod(object): class Subpod(object):
""" """

View File

@ -27,7 +27,7 @@ def test_basic(API_key):
res = client.query('30 deg C in deg F') res = client.query('30 deg C in deg F')
assert len(res.pods) > 0 assert len(res.pods) > 0
results = list(res.results) results = list(res.results)
assert results[0].text == ['86 °F (degrees Fahrenheit)'] assert results[0].text == '86 °F (degrees Fahrenheit)'
def test_invalid_app_id(): def test_invalid_app_id():
client = wolframalpha.Client('abcdefg') client = wolframalpha.Client('abcdefg')