Пример #1
0
 def test_removed_attr(self):
     value = obj.popattr(self.o, 'test')
     assert value == 1
     # verify that attr was removed from the object
     with pytest.raises(AttributeError):
         obj.popattr(self.o, 'test')
Пример #2
0
 def test_nonexistent_attr(self):
     # object with attr trying to get nonexistent attr
     with pytest.raises(AttributeError):
         obj.popattr(self.o, 'nonexistent')
Пример #3
0
 def test_fallback(self):
     # object with attr trying to get nonexistent attr using fallback
     value = obj.popattr(self.o, 'nonexistent', 2)
     assert value == 2
Пример #4
0
 def test_no_attrs(self):
     # object without any attrs
     with pytest.raises(AttributeError):
         obj.popattr(object(), 'nonexistent')
Пример #5
0
 def test_removed_attr(self):
     value = obj.popattr(self.o, 'test')
     assert value == 1
     # verify that attr was removed from the object
     with pytest.raises(AttributeError):
         obj.popattr(self.o, 'test')
Пример #6
0
 def test_fallback(self):
     # object with attr trying to get nonexistent attr using fallback
     value = obj.popattr(self.o, 'nonexistent', 2)
     assert value == 2
Пример #7
0
 def test_nonexistent_attr(self):
     # object with attr trying to get nonexistent attr
     with pytest.raises(AttributeError):
         obj.popattr(self.o, 'nonexistent')
Пример #8
0
 def test_no_attrs(self):
     # object without any attrs
     with pytest.raises(AttributeError):
         obj.popattr(object(), 'nonexistent')