python编程try。。raise的问题
defassertequal(self,driver,title,exptitle):try:self.assertEqual(title,exptitle,'对比失败'...
def assertequal(self, driver, title, exptitle):
try:
self.assertEqual(title, exptitle, '对比失败')
except AssertionError:
Page.insert_img(driver, 'lctest2.png')
raise AssertionError('对比失败啦')
if __name__ == '__main__':
driver = webdriver.Ie()
driver.get("https://www.baidu.com")
page = Page()
page.assertequal(driver, 'a', 'a')
driver.quit()
为什么加上最后的raise就会报错呢 展开
try:
self.assertEqual(title, exptitle, '对比失败')
except AssertionError:
Page.insert_img(driver, 'lctest2.png')
raise AssertionError('对比失败啦')
if __name__ == '__main__':
driver = webdriver.Ie()
driver.get("https://www.baidu.com")
page = Page()
page.assertequal(driver, 'a', 'a')
driver.quit()
为什么加上最后的raise就会报错呢 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询