def test_get_book_returns_None_if_not_within_book(self): root = self.stub() self.expect(root.__parent__, None) obj = self.set_parent(self.stub(), self.set_parent(self.stub(), root)) self.replay() layout = DefaultBookLayout(obj, object(), object()) self.assertEqual(layout.get_book(), None)
def test_get_book_walks_up(self): book = self.providing_stub([IBook]) subchapter = self.set_parent(self.stub(), self.set_parent(self.stub(), book)) self.replay() layout = DefaultBookLayout(subchapter, object(), object()) self.assertEqual(layout.get_book(), book)
def test_get_book_walks_up(self): book = self.providing_stub([IBook]) subchapter = self.set_parent( self.stub(), self.set_parent( self.stub(), book)) self.replay() layout = DefaultBookLayout(subchapter, object(), object()) self.assertEqual(layout.get_book(), book)
def test_get_book_returns_None_if_not_within_book(self): root = self.stub() self.expect(root.__parent__, None) obj = self.set_parent( self.stub(), self.set_parent( self.stub(), root)) self.replay() layout = DefaultBookLayout(obj, object(), object()) self.assertEqual(layout.get_book(), None)