Ejemplo n.º 1
0
def complex_doc():
    return (Document().add_line("My second sentence.").add_line(
        "My first sentence.").swap_lines(0, 1).add_line(
            "Introduction", 0).add_punctuation(
                "!",
                0).add_line("").add_line("My second paragraph.").merge_lines(
                    [1, 2]))
Ejemplo n.º 2
0
def full_case_doc():
    return (Document().add_line("1")  # 1
            .add_line("2", 0)  # 2\n1
            .add_line("3", 1)  # 2\n3\n1
            .swap_lines(0, 1)  # 3\n2\n1
            .swap_lines(1, 2)  # 3\n1\n2
            .swap_lines(2, 1)  # 3\n2\n1
            .merge_lines([0, 2])  # 3 1\n2
            .merge_lines([0, 1]))  # 3 1 2)
Ejemplo n.º 3
0
def punctuation_doc():
    return (Document().add_line("").add_punctuation(".", 0).add_punctuation(
        "!", 0).add_punctuation("?",
                                0).add_line(".").add_punctuation("?",
                                                                 1))  # ?\n?)
Ejemplo n.º 4
0
def edgy_doc():
    return Document().add_line("").swap_lines(0, 0).merge_lines(
        [0]).add_punctuation(".", 0)
Ejemplo n.º 5
0
def tale_doc():
    return (Document().add_line("This is the tale of a dwarf.").add_line(
        "").add_line("A dwarf you ask?").add_line(
            "Yes, a dwarf and not any dwarf, so you know!"))
Ejemplo n.º 6
0
def four_liner_doc():
    return (Document().add_line("first").add_line("fourth").add_line(
        "third", 1).add_line("second", 1))
Ejemplo n.º 7
0
def doc(request):
    """Factory method for test documents"""
    return DOCS.get(request.param, Document())
Ejemplo n.º 8
0
import pytest

from chaining_docs import Document

EOL_PUNCTUATION = ".!?"

DOCS = {
    "four-liner": (Document().add_line("first").add_line("fourth").add_line(
        "third", 1).add_line("second", 1)),
    "tale": (Document().add_line("This is the tale of a dwarf.").add_line(
        "").add_line("A dwarf you ask?").add_line(
            "Yes, a dwarf and not any dwarf, so you know!")),
    "complex":
    (Document().add_line("My second sentence.").add_line("My first sentence.").
     swap_lines(0, 1).add_line("Introduction", 0).add_punctuation(
         "!",
         0).add_line("").add_line("My second paragraph.").merge_lines([1, 2])),
    "edgy": (Document().add_line("").swap_lines(0, 0).merge_lines(
        [0]).add_punctuation(".", 0)),
    "full-case": (
        Document().add_line("1")  # 1
        .add_line("2", 0)  # 2\n1
        .add_line("3", 1)  # 2\n3\n1
        .swap_lines(0, 1)  # 3\n2\n1
        .swap_lines(1, 2)  # 3\n1\n2
        .swap_lines(2, 1)  # 3\n2\n1
        .merge_lines([0, 2])  # 3 1\n2
        .merge_lines([0, 1])  # 3 1 2
    ),
    "punctuation": (
        Document().add_line("").add_punctuation(".", 0).add_punctuation(