def test_invalid_get_attribute(self): tag = Tag('img', src='http://i.imgur.com/iWHK2.gif', alt='Cats are liquid, not solid.') with self.assertRaises(KeyError): tag.get_attribute('href') with self.assertRaises(KeyError): tag['title']
def test_invalid_get_attribute(self): tag = Tag('img', src='http://i.imgur.com/iWHK2.gif', alt='Cats are liquid, not solid.') with self.assertRaises(KeyError): tag.get_attribute('href') with self.assertRaises(KeyError): tag['title']
def test_get_attribute(self): tag = Tag('img', src='http://i.imgur.com/iWHK2.gif', alt='Cats are liquid, not solid.') self.assertEqual(tag.get_attribute('src'), 'http://i.imgur.com/iWHK2.gif') self.assertEqual(tag['alt'], 'Cats are liquid, not solid.')
def test_get_attribute(self): tag = Tag('img', src='http://i.imgur.com/iWHK2.gif', alt='Cats are liquid, not solid.') self.assertEqual( tag.get_attribute('src'), 'http://i.imgur.com/iWHK2.gif') self.assertEqual( tag['alt'], 'Cats are liquid, not solid.')