Ejemplo n.º 1
0
def test_fragments():
    expected_output_file_path = get_fixture('text', 'asnyk_miedzy_nami_fragments.html')

    closed_fragments, open_fragments = extract_fragments(
        get_fixture('text', 'asnyk_miedzy_nami_expected.html'))
    assert not open_fragments
    fragments_text = u"\n\n".join(u"%s: %s\n%s" % (f.id, f.themes, f) for f in closed_fragments.values())
    assert_equal(fragments_text, file(expected_output_file_path).read().decode('utf-8'))
Ejemplo n.º 2
0
def test_transform():
    expected_output_file_path = get_fixture('text', 'asnyk_miedzy_nami_expected.html')

    html = WLDocument.from_file(
            get_fixture('text', 'miedzy-nami-nic-nie-bylo.xml')
        ).as_html().get_string()

    assert_equal(html, file(expected_output_file_path).read())
Ejemplo n.º 3
0
def test_transform():
    expected_output_file_path = get_fixture('text',
                                            'asnyk_miedzy_nami_expected.txt')

    text = WLDocument.from_file(
        get_fixture('text',
                    'miedzy-nami-nic-nie-bylo.xml')).as_text().get_string()

    assert_equal(text, file(expected_output_file_path).read())
Ejemplo n.º 4
0
def test_fragments():
    expected_output_file_path = get_fixture(
        'text', 'asnyk_miedzy_nami_fragments.html')

    closed_fragments, open_fragments = extract_fragments(
        get_fixture('text', 'asnyk_miedzy_nami_expected.html'))
    assert not open_fragments
    fragments_text = u"\n\n".join(u"%s: %s\n%s" % (f.id, f.themes, f)
                                  for f in closed_fragments.values())
    assert_equal(fragments_text,
                 file(expected_output_file_path).read().decode('utf-8'))
Ejemplo n.º 5
0
def test_transform():
    temp = NamedTemporaryFile(delete=False)
    temp.close()
    WLDocument.from_file(
            get_fixture('text', 'asnyk_zbior.xml'),
            provider=DirDocProvider(get_fixture('text', ''))
        ).as_pdf(save_tex=temp.name)
    tex = open(temp.name).read().decode('utf-8')
    print tex

    # Check contributor list.
    editors = re.search(ur'\\def\\editors\{Opracowanie redakcyjne i przypisy: ([^}]*?)\.\s*\}', tex)
    assert_equal(editors.group(1), u"Adam Fikcyjny, Aleksandra Sekuła, Olga Sutkowska")
Ejemplo n.º 6
0
def test_transform():
    temp = NamedTemporaryFile(delete=False)
    temp.close()
    WLDocument.from_file(get_fixture('text', 'asnyk_zbior.xml'),
                         provider=DirDocProvider(get_fixture(
                             'text', ''))).as_pdf(save_tex=temp.name)
    tex = open(temp.name).read().decode('utf-8')
    print tex

    # Check contributor list.
    editors = re.search(
        ur'\\def\\editors\{Opracowanie redakcyjne i przypisy: ([^}]*?)\.\s*\}',
        tex)
    assert_equal(editors.group(1),
                 u"Adam Fikcyjny, Aleksandra Sekuła, Olga Sutkowska")
Ejemplo n.º 7
0
def basic_test():
    """The generated performance report should correctly describe test file
    name and "weight" of only those files which exited with successful error
    codes."""
    fixture_names = ['pass.py', 'fail.py', 'fail.py', 'pass.py']
    files = map(lambda name: [get_fixture(name)], fixture_names)
    perf_report = spawner.execute('python', files, Logger())

    assert(len(perf_report) == 2)

    for report in perf_report:
        assert(type(report['weight']) == float)
        assert(report['weight'] > 0)

    report_files = map(operator.itemgetter('file_name'), perf_report)

    assert(files[0][0] in report_files)
    assert(files[3][0] in report_files)
Ejemplo n.º 8
0
    def main(self):
        config = {
            "env": {
                "type": "mk"
            },
        }
        for application in settings.CONFIGURE_APPS:
            try:
                method = getattr(self,
                                 "generate_{}_config".format(application))
                config.update({application: method()})
                LOG.info("INFO: {} configured".format(application))
            except NoApplication:
                LOG.info("INFO: No {} installed, skip".format(application))

        config_filename = utils.get_fixture("config.yaml",
                                            check_existence=False)
        LOG.info("INFO: Saving config to {}".format(config_filename))
        with open(config_filename, "w") as f:
            yaml.safe_dump(config, f, default_flow_style=False)
Ejemplo n.º 9
0
def test_passing_parse_dublincore_to_transform():
    """Passing parse_dublincore=False to the constructor omits DublinCore parsing."""
    WLDocument.from_file(
        get_fixture('text', 'asnyk_miedzy_nami_nodc.xml'),
        parse_dublincore=False,
    ).as_text()
Ejemplo n.º 10
0
def test_no_dublincore():
    WLDocument.from_file(get_fixture('text',
                                     'asnyk_miedzy_nami_nodc.xml')).as_text()
Ejemplo n.º 11
0
def test_passing_parse_dublincore_to_transform():
    """Passing parse_dublincore=False to transform omits DublinCore parsing."""
    WLDocument.from_file(
            get_fixture('text', 'asnyk_miedzy_nami_nodc.xml'),
            parse_dublincore=False,
        ).as_html()
Ejemplo n.º 12
0
def test_no_dublincore():
    WLDocument.from_file(
            get_fixture('text', 'asnyk_miedzy_nami_nodc.xml')
        ).as_html()
Ejemplo n.º 13
0
def test_transform():
    WLDocument.from_file(
            get_fixture('text', 'asnyk_zbior.xml'),
            provider=DirDocProvider(get_fixture('text', ''))
        ).as_epub(flags=['without_fonts'])