def addArgument(argArr): #split argument array into parts prompt = argArr[0] newArgument = argArr[1] parent = argArr[2] stance = argArr[3] #get sf doc sfStr = fm.getFile(prompt + ".json") sfJSON = json.loads(sfStr) sf.set_doc(sfJSON) #deal with parent argument being the debate prompt if (parent == "newReply"): parent = prompt #create argument if (stance == "agree"): sf.add_support(None, [newArgument], sf.get_atom_id(parent), None) if (stance == "disagree"): sf.add_conflict(None, newArgument, sf.get_atom_id(parent), None) #write updated sfDoc to file sfJSONex = sf.export_json() fm.createFile(sfJSONex) return None
def test_getFile(self): self.assertIsNotNone(fm.getFile("test prompt.json"))
def test_getArguments(self): sfStr = fm.getFile("test prompt.json") self.assertIsNotNone(t.getArguments(sfStr))
def test_getData(self): sfStr = fm.getFile("test prompt.json") returnedData = t.getData(sfStr) correctData = [['null', 'test prompt', 'null']] self.assertEqual(returnedData, correctData)
def test_getPrompt(self): sfStr = fm.getFile("test prompt.json") returnedPrompt = t.getPrompt(sfStr) correctPrompt = "test prompt" self.assertEqual(returnedPrompt, correctPrompt)