Feed the hobgoblins (delint).

master
Jason R. Coombs 6 years ago
parent 9e0a04079f
commit 923b505128
  1. 8
      conftest.py
  2. 11
      wolframalpha/__init__.py
  3. 1
      wolframalpha/compat.py
  4. 3
      wolframalpha/test_client.py

@ -8,10 +8,10 @@ import wolframalpha
if six.PY2: if six.PY2:
collect_ignore = [ collect_ignore = [
'wolframalpha/pmxbot.py', 'wolframalpha/pmxbot.py',
'wolframalpha/test_pmxbot.py', 'wolframalpha/test_pmxbot.py',
] ]
@pytest.fixture(scope='session') @pytest.fixture(scope='session')

@ -62,7 +62,7 @@ class ErrorHandler(object):
self._handle_error() self._handle_error()
def _handle_error(self): def _handle_error(self):
if not 'error' in self: if 'error' not in self:
return return
template = 'Error {error[code]}: {error[msg]}' template = 'Error {error[code]}: {error[msg]}'
@ -97,7 +97,7 @@ class Assumption(Document):
text = self.template.replace('${desc1}', self.description) text = self.template.replace('${desc1}', self.description)
try: try:
text = text.replace('${word}', self.word) text = text.replace('${word}', self.word)
except: except Exception:
pass pass
return text[:text.index('. ') + 1] return text[:text.index('. ') + 1]
@ -207,7 +207,12 @@ class Result(ErrorHandler, Document):
""" """
The pods that hold the response to a simple, discrete query. The pods that hold the response to a simple, discrete query.
""" """
return (pod for pod in self.pods if pod.primary or pod.title=='Result') return (
pod
for pod in self.pods
if pod.primary
or pod.title == 'Result'
)
@property @property
def details(self): def details(self):

@ -1,6 +1,7 @@
import six import six
from six.moves import http_client from six.moves import http_client
def fix_HTTPMessage(): def fix_HTTPMessage():
""" """
Python 2 uses a deprecated method signature and doesn't provide the Python 2 uses a deprecated method signature and doesn't provide the

@ -1,4 +1,4 @@
#-*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
@ -13,6 +13,7 @@ import wolframalpha
def temp_result(client): def temp_result(client):
return client.query('30 deg C in deg F') return client.query('30 deg C in deg F')
def test_basic(temp_result): def test_basic(temp_result):
res = temp_result res = temp_result
assert len(list(res.pods)) > 0 assert len(list(res.pods)) > 0

Loading…
Cancel
Save