Esempio n. 1
0
    def test_pos_02(self):
        "Check top level RecordAsDict (fd)"

        fd = StringIO.StringIO(doc1)
        txt_doc = TxtRecord.from_fd(fd, "Nothing", TxtIOConfig())
        txt_doc_dict = txt_doc.get_dict()

        assert(txt_doc.get_comment() == dpC1)
        assert(txt_doc_dict["Name"].get_content() == "meiner")
        assert(txt_doc_dict["Note"].get_content() == "This is my Note.")
        assert(txt_doc.to_string()==doc1)
Esempio n. 2
0
    def test_pos_02(self):
        "Check top level RecordAsDict (fd)"

        fd = StringIO.StringIO(doc1)
        txt_doc = TxtRecord.from_fd(fd, "Nothing", TxtIOConfig())
        txt_doc_dict = txt_doc.get_dict()

        assert (txt_doc.get_comment() == dpC1)
        assert (txt_doc_dict["Name"].get_content() == "meiner")
        assert (txt_doc_dict["Note"].get_content() == "This is my Note.")
        assert (txt_doc.to_string() == doc1)
Esempio n. 3
0
    def rmttest_pos_02(self):
        "Check top level RecordAsDict (fd)"

        fd = StringIO(doc1)
        txt_doc = TxtRecord.from_fd(fd, u"Nothing", TxtIOConfig())
        txt_doc_dict = txt_doc.get_dict()

        assert dpC1 == txt_doc.get_comment()
        assert "meiner" == txt_doc_dict["Name"].get_content()
        assert "This is my Note." == \
            txt_doc_dict["Note"].get_content()
        assert doc1 == txt_doc.to_string()
Esempio n. 4
0
    def rmttest_pos_02(self):
        "Check top level RecordAsDict (fd)"

        fd = StringIO(doc1)
        txt_doc = TxtRecord.from_fd(fd, u"Nothing", TxtIOConfig())
        txt_doc_dict = txt_doc.get_dict()

        self.assertEqual(dpC1, txt_doc.get_comment())
        self.assertEqual("meiner", txt_doc_dict["Name"].get_content())
        self.assertEqual("This is my Note.",
                         txt_doc_dict["Note"].get_content())
        self.assertEqual(doc1, txt_doc.to_string())
Esempio n. 5
0
 def read(self):
     self.digraph.add_node(self)
     fd = file(os.path.join(self.dir, self.name + ".tic"))
     self.t = TxtRecord.from_fd(fd, self.name, 
                                self.parser_config)
     for tag in self.t:
         # If the topic has subtopics, read them also in.
         if tag.get_tag()=="SubTopic":
             ntopic = Topic(self.dir, tag.get_content(), self.digraph,
                            self.parser_config, self.level+1, self)
             #self.outgoing.append(ntopic)
             Digraph.create_edge(self, ntopic)
             #self.outgoing.append(ntopic)
     fd.close()
Esempio n. 6
0
    def input(self, fd):
        # Read it in from the file (Syntactic input)
        self.record = TxtRecord.from_fd(fd, self.id,
                                 self.config.txtio[self.type_str])
        brmo = self.record.get_dict()
        # This 'brmo' is always valid - if there is a problem, an exception 
        # is raised.

        # Handle all the modules (Semantic input)
        self.handle_modules_tag(brmo)

        # Do not check for remaining tags here. There must be some
        # left over: all those that work on the whole requirement set
        # (e.g. 'Solved by').

        # If everything's fine, store the rest of the req for later
        # inspection.
        self.brmo = brmo