def test_genTableWorks(self): model = [[2, 1], [3, 0], [0, 3], [1, 2]] table = helpers.genTable(4) self.assertEqual(model, table)
if len(sys.argv) < 2: raise SystemExit, "Provide source for participants in arguments" # read first argument and use it as source for participants sourcepath = sys.argv[1] participantFile = open(sourcepath, "r") participants = json.loads(participantFile.read()) participantFile.close() # generate table to match participants # NOTE: must be even number, otherwise raises ValueError table = helpers.genTable(len(participants)) # determine population size populationSize = len(participants) * 3 if len(sys.argv) > 2: populationSize = int(sys.argv[2]) # determine how many generations to run generations = len(participants) * 50 if len(sys.argv) > 3: generations = int(sys.argv[3]) target = "" if len(sys.argv) > 4: target = sys.argv[4]
def test_genTableWorksBigger(self): model = [[2, 1], [3, 0], [0, 4, 3], [1, 5, 2], [2, 5], [3, 4]] table = helpers.genTable(6) self.assertEqual(model,table)