def test_warning_with_forwarding(): au = scopus.AuthorRetrieval("57191449583", refresh=False) with warnings.catch_warnings(record=True) as w: auth_id = au.identifier assert_equal(len(w), 1) assert_true(issubclass(w[-1].category, UserWarning)) assert_true("57191449583" in str(w[-1].message)) assert_equal(auth_id, '36854449200')
def test_warning_without_forwarding(): with warnings.catch_warnings(record=True) as w: au = scopus.AuthorRetrieval("24079538400", refresh=False) assert_equal(len(w), 1) assert_true(issubclass(w[-1].category, UserWarning)) assert_true("24079538400" in str(w[-1].message))
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for `AuthorRetrieval` module.""" import warnings from collections import Counter from nose.tools import assert_equal, assert_true import scopus warnings.simplefilter("always") au = scopus.AuthorRetrieval("7004212771", refresh=True) def test_affiliation_current(): assert_equal(au.affiliation_current, '110785688') def test_affiliation_history(): affs = au.affiliation_history assert_true(len(affs) >= 5) assert_true(isinstance(affs[0], str)) def test_citation_count(): assert_true(int(au.citation_count) >= 7584) def test_cited_by_count(): assert_true(int(au.cited_by_count) >= 6066)