def test_get_doi(self): sampler = IdSampler() dois_list = sampler.get_dois() try: assert re.match(self.doi_regex, dois_list[0]), dois_list except IndexError: print "random doi is down"
def test_get_multiple_dois(self): sampler = IdSampler() dois_list = sampler.get_dois(10) try: dois_list[0] # test to see if random doi service down first assert_equals(len(dois_list), 10) assert re.match(self.doi_regex, dois_list[7]), dois_list except IndexError: print "random doi is down"