Ejemplo n.º 1
0
    def test_para_format(self):
        inp = """This tests the paragraph formatting functionality that 
                 will be used to disply resource descriptions.  This is not 
                 meant for display purpoes only.

                 It must be able to handle to handle multiple paragrasphs.  
                 The normal delimiter is a pair of consecutive new-line 
                 charactere, but other markup will be recognized as well,
                 e.g. "&lt;p&gt;".  <p> Formatting must be succeesful for 
                 $n$ paragraphs where $n > 1$.  It should even work on $n^2$ 
                 paragraphs."""

        out = """This tests the paragraph formatting
functionality that will be used to
disply resource descriptions.  This is
not meant for display purpoes only.

It must be able to handle to handle
multiple paragrasphs. The normal
delimiter is a pair of consecutive new-
line charactere, but other markup will
be recognized as well, e.g. "<p>".

Formatting must be succeesful for n
paragraphs where n > 1.  It should even
work on n^2 paragraphs."""

        text = dalq.para_format_desc(inp, 40)
        if text != out:
            for i in range(len(text)):
                if text[i] != out[i]:
                    print("format different from expected starting with: "+
                          text[i:])
                    break
        self.assertEquals(text, out, "Incorrect formatting.")
Ejemplo n.º 2
0
    def test_para_format(self):
        inp = """This tests the paragraph formatting functionality that 
                 will be used to disply resource descriptions.  This is not 
                 meant for display purpoes only.

                 It must be able to handle to handle multiple paragrasphs.  
                 The normal delimiter is a pair of consecutive new-line 
                 charactere, but other markup will be recognized as well,
                 e.g. "&lt;p&gt;".  <p> Formatting must be succeesful for 
                 $n$ paragraphs where $n > 1$.  It should even work on $n^2$ 
                 paragraphs."""

        out = """This tests the paragraph formatting
functionality that will be used to
disply resource descriptions.  This is
not meant for display purpoes only.

It must be able to handle to handle
multiple paragrasphs. The normal
delimiter is a pair of consecutive new-
line charactere, but other markup will
be recognized as well, e.g. "<p>".

Formatting must be succeesful for n
paragraphs where n > 1.  It should even
work on n^2 paragraphs."""

        text = dalq.para_format_desc(inp, 40)
        if text != out:
            for i in range(len(text)):
                if text[i] != out[i]:
                    print("format different from expected starting with: " +
                          text[i:])
                    break
        self.assertEquals(text, out, "Incorrect formatting.")
Ejemplo n.º 3
0
    def test_fill(self):
        inp = """
The quick brown 
fox jumped over 
the lazy dogs.
"""
        out = """The quick brown fox jumped over the
lazy dogs."""

        self.assertEquals(dalq.para_format_desc(inp, 38), out)
Ejemplo n.º 4
0
    def test_fill(self):
        inp = """
The quick brown 
fox jumped over 
the lazy dogs.
"""
        out = """The quick brown fox jumped over the
lazy dogs."""

        self.assertEquals(dalq.para_format_desc(inp, 38), out)
Ejemplo n.º 5
0
 def test_para_detect(self):
     for t in self.splittests:
         self.assertEquals(dalq.para_format_desc(t), "one\n\ntwo")
Ejemplo n.º 6
0
 def test_para_detect(self):
     for t in self.splittests:
         self.assertEquals(dalq.para_format_desc(t), "one\n\ntwo")