def test_generator(self): def _gen(n=5): while n > 0: yield n n -= 1 assert max(_gen()) == 5 assert max_safe(_gen(), default=3) == 5
def side_width(self): """The width of the side block with rows descriptions""" return max_safe(map(len, self.board.rows_descriptions), default=0)
def header_height(self): """The size of the header block with columns descriptions""" return max_safe(map(len, self.board.columns_descriptions), default=0)
def _the_same_as_max(cls, *args, **kwargs): a = max_safe(*args, **kwargs) b = max(*args, **kwargs) assert a == b return a
def test_empty_true_object_with_default(self): assert max_safe(iter([]), default=28) == 28
def test_empty_with_default(self): assert max_safe([], default=21) == 21