Exemple #1
0
    def test_reset(self):
        """
        Tests: sadface.reset()

        A sadface document is created and manipulated then reset is used
        to return the document to it's initial state
        """

        # Iniitialise a SADFace document
        sf.initialise()
        expected = None
        out = sf.get_title()
        self.assertEqual(out, expected)

        # Explicitly alter it
        expected = "DAKA DAKA"
        sf.set_title(expected)
        out = sf.get_title()
        self.assertEqual(out, expected)

        # Reset the document - this should now be in the pre-init, empty-dict state
        sf.reset()
        expected = {}
        out = sf.sd
        self.assertEqual(out, expected)
Exemple #2
0
 def test_set_title(self):
     """
     Tests: sadface.get_title() & set_title
     """
     sf.initialise()
     t = "test title"
     sf.set_title(t)
     out = sf.get_title()
     expected = t
     self.assertEqual(out, expected)
Exemple #3
0
def addPrompt(prompt):
    #set metadata
    #create sf doc
    sf.initialise()
    #add prompt statement
    sf.add_atom(prompt)
    #set prompt as claim
    sf.set_claim(sf.get_atom_id(prompt))
    #set title
    sf.set_title(prompt)

    #create file
    sfJSON = sf.export_json()
    fm.createFile(sfJSON)

    return None


#add vote
#argument = array with title and argument voted for
#returns status
import json

import sadface as sf


sf.config.init("etc/test.cfg")
sf.initialise()

sf.set_title("very important")
sf.add_notes("some nonsense about stuff...")
sf.append_notes("yet more notes n stuff")
sf.set_description("a cohesive description of this argument document")

con1 = "You should treasure every moment"
prem1 = ["if you are going to die then you should treasure every moment", "You are going to die"]
arg1 = sf.add_argument(con_text=con1, prem_text=prem1, con_id=None, prem_id=None)

t1 = sf.get_atom_id("You are going to die")

prem2 = ["Every person is going to die", "You are a person"]
arg2 = sf.add_support(con_text=None, prem_text=prem2, con_id=t1, prem_id=None)

prem3 = "YOLO"
arg3 = sf.add_conflict(arg_id=t1, conflict_text=prem3)
print(sf.prettyprint())


dot = sf.export_dot()#trad=False)    # Uncomment to use the brewer colourscheme
with open('out.dot', 'w') as file:
    file.write(dot)
Exemple #5
0
def createTestFile():
    sf.initialise()
    sf.set_title("test file")
    return sf.export_json()