From 772ce9b34da42897061216dc5c02e712dee8f79d Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 3 Oct 2012 18:26:58 -0400 Subject: [PATCH] Added test --- wolframalpha/__init__.py | 3 ++- wolframalpha/test_client.py | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 wolframalpha/test_client.py diff --git a/wolframalpha/__init__.py b/wolframalpha/__init__.py index 7e271c4..2e2ce87 100644 --- a/wolframalpha/__init__.py +++ b/wolframalpha/__init__.py @@ -23,5 +23,6 @@ class Client(object): )) url = 'http://api.wolframalpha.com/v2/query?' + query resp = urllib2.urlopen(url) - assert resp.headers['Content-Type'] == 'application/xml' + assert resp.headers.gettype() == 'text/xml' + assert resp.headers.getparam('charset') == 'utf-8' return Result(resp) diff --git a/wolframalpha/test_client.py b/wolframalpha/test_client.py new file mode 100644 index 0000000..0989ff5 --- /dev/null +++ b/wolframalpha/test_client.py @@ -0,0 +1,8 @@ +import wolframalpha + +app_id = 'Q59EW4-7K8AHE858R' +"App ID for testing this project. Please don't use for other apps." + +def test_basic(): + client = wolframalpha.Client(app_id) + client.query('30 deg C in deg F')