Skip to content

Commit db90561

Browse files
committed
added tests
1 parent 98d4894 commit db90561

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

pigeon.jpg

7.61 KB
Loading

tests.py

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
test_text = 'Bob broke my heart, and then made up this silly sentence to test the PHP SDK'
2424
test_html = '<html><head><title>The best SDK Test | AlchemyAPI</title></head><body><h1>Hello World!</h1><p>My favorite language is PHP</p></body></html>'
2525
test_url = 'http://www.nytimes.com/2013/07/13/us/politics/a-day-of-friction-notable-even-for-a-fractious-congress.html?_r=0'
26-
26+
test_jpg = 'pigeon.jpg'
2727

2828

2929
alchemyapi = AlchemyAPI()
@@ -228,6 +228,56 @@
228228
print('')
229229
print('')
230230

231+
#imagetagging
232+
print('Checking imagetagging . . . ')
233+
response = alchemyapi.imageTagging('text', test_text);
234+
assert(response['status'] == 'ERROR')
235+
response = alchemyapi.imageTagging('html', test_html);
236+
assert(response['status'] == 'ERROR')
237+
response = alchemyapi.imageTagging('url', test_url);
238+
assert(response['status'] == 'OK')
239+
response = alchemyapi.imageTagging('image', test_jpg);
240+
assert(response['status'] == 'OK')
241+
print('Image tagging tests complete!')
242+
print('')
243+
print('')
244+
245+
#combined
246+
print('Checking combined . . . ')
247+
response = alchemyapi.combined('text', test_text);
248+
assert(response['status'] == 'OK')
249+
response = alchemyapi.combined('html', test_html);
250+
assert(response['status'] == 'ERROR')
251+
response = alchemyapi.combined('url', test_url);
252+
assert(response['status'] == 'OK')
253+
print('Combined tests complete!')
254+
print('')
255+
print('')
256+
257+
#taxonomy
258+
print('Checking taxonomy . . . ')
259+
response = alchemyapi.taxonomy('text', test_text);
260+
assert(response['status'] == 'OK')
261+
response = alchemyapi.taxonomy('html', test_html, {'url':'test'});
262+
assert(response['status'] == 'OK')
263+
response = alchemyapi.taxonomy('url', test_url);
264+
assert(response['status'] == 'OK')
265+
print('Taxonomy tests complete!')
266+
print('')
267+
print('')
268+
269+
#image
270+
print('Checking image extraction . . . ')
271+
response = alchemyapi.imageExtraction('text', test_text);
272+
assert(response['status'] == 'ERROR')
273+
response = alchemyapi.imageExtraction('html', test_html);
274+
assert(response['status'] == 'ERROR')
275+
response = alchemyapi.imageExtraction('url', test_url);
276+
assert(response['status'] == 'OK')
277+
print('Image Extraction tests complete!')
278+
print('')
279+
print('')
280+
231281

232282
print('**** All tests complete! ****')
233283

0 commit comments

Comments
 (0)