def test_alloc_type_board_bad(self, specific, max_dead_boards, max_dead_links): a = Allocator(2, 3) if specific: args = (3, 2, 1) else: args = tuple() with pytest.raises(ValueError): a._alloc_type(*args, max_dead_boards=max_dead_boards, max_dead_links=max_dead_links, require_torus=True)
def test_alloc_type_triads(self, max_dead_boards, max_dead_links, require_torus): a = Allocator(2, 3) if require_torus: kwargs = {"require_torus": False} else: kwargs = {} assert a._alloc_type(1, 2, max_dead_boards=max_dead_boards, max_dead_links=max_dead_links, **kwargs) \ is _AllocationType.triads
def test_alloc_type_board(self, _type, max_dead_boards, max_dead_links, add_require_torus_false): a = Allocator(2, 3) if _type == "empty": args = tuple() elif _type == "one": args = (1, ) else: # _type == "specific": args = (1, 1, 1) if add_require_torus_false: kwargs = {"require_torus": False} else: kwargs = {} assert a._alloc_type(*args, max_dead_boards=max_dead_boards, max_dead_links=max_dead_links, **kwargs) is _AllocationType.board