def test_save_and_load(): graph = CoachingGraph() graph.init_semi_random(100) graph.save_as('save_and_load') graphB = CoachingGraph() graphB.load_from('save_and_load') assert len(graph.users) == len(graphB.users)
def test_save_and_load(): graph = CoachingGraph() graph.init_semi_random(100) graph.save_as('save_and_load') graphB = CoachingGraph() graphB.load_from('save_and_load') assert len(graph.users) == len(graphB.users)
def generate_test_graphs_connected(dirName, numGraphs, maxSize): logger.info("generating test graphs in directory: {}".format(dirName)) folderPath = refresh_testData_folder(dirName) for i in range(numGraphs): graph = CoachingGraph() fileNumber = i + 1 fileName = '{}_'.format(fileNumber) + TEST_GRAPH_SUFFIX randomSize = random.randint(40, maxSize) graph.init_semi_random_connected(randomSize) filePath = os.path.join(folderPath, fileName) graph.save_as(filePath)
def generate_test_graphs_connected(dirName, numGraphs, maxSize): logger.info("generating test graphs in directory: {}".format(dirName)) folderPath = refresh_testData_folder(dirName) for i in range(numGraphs): graph = CoachingGraph() fileNumber = i + 1 fileName = '{}_'.format(fileNumber) + TEST_GRAPH_SUFFIX randomSize = random.randint(40, maxSize) graph.init_semi_random_connected(randomSize) filePath = os.path.join(folderPath, fileName) graph.save_as(filePath)
def generate_test_graphs(dirName, numGraphs, maxSize): logger.info("generating test graphs in directory: {}".format(dirName)) folderPath = refresh_testData_folder(dirName) graphs = [] for i in range(numGraphs): graph = CoachingGraph() fileNumber = i + 1 fileName = '{}_'.format(fileNumber) + TEST_GRAPH_SUFFIX randomSize = random.randint(100, maxSize) randomInternalConnections = random.randint(2, 12) randomCoacheesFactor = random.randint(2, 5) graph.init_semi_random(200, randomInternalConnections, randomCoacheesFactor) graphs.append(graph) filePath = os.path.join(folderPath, fileName) graph.save_as(filePath) return graphs
def generate_test_graphs(dirName, numGraphs, maxSize): logger.info("generating test graphs in directory: {}".format(dirName)) folderPath = refresh_testData_folder(dirName) graphs = [] for i in range(numGraphs): graph = CoachingGraph() fileNumber = i + 1 fileName = '{}_'.format(fileNumber) + TEST_GRAPH_SUFFIX randomSize = random.randint(100, maxSize) randomInternalConnections = random.randint(2, 12) randomCoacheesFactor = random.randint(2, 5) graph.init_semi_random(200, randomInternalConnections, randomCoacheesFactor) graphs.append(graph) filePath = os.path.join(folderPath, fileName) graph.save_as(filePath) return graphs