コード例 #1
0
 def test_attribute_error_for_empty(self):
     """
     should raise AttributeError when the list is empty
     and someone tries to access a method or property on it
     """
     with self.assertRaises(AttributeError):
         the_list = ElementList([])
         the_list.unknown_method()
コード例 #2
0
 def test_attribute_error_for_empty(self):
     """
     should raise AttributeError when the list is empty
     and someone tries to access a method or property on it
     """
     with self.assertRaises(AttributeError):
         the_list = ElementList([])
         the_list.unknown_method()
コード例 #3
0
def test_attribute_error_method_for_empty():
    """
    should raise ElementDoesNotExist when the list is empty
    and someone tries to access a method or property on the child element.
    """
    with pytest.raises(ElementDoesNotExist):
        the_list = ElementList([])
        the_list.unknown_method()