Beispiel #1
0
def test_from_presentations():
    # The following relies on the sections being "supposed to be" stitched together in
    # alphabetical order.
    final = Presentation.from_presentations(
        Presentation(path) for path in SECTIONS_DIR.glob('section_*.md'))
    actual = final.to_html()
    expected = SECTION_OUTPUT.read_text()
    assert_html_equiv(actual, expected)
Beispiel #2
0
def test_titled_multi_section():
    '''
    Premark will create title slides for sections with a title field in their config.
    '''
    prez = Presentation(SECTIONS_DIR,
                        config_file=SECTIONS_DIR / 'titled_sections.yaml')
    actual = prez.to_html()
    expected = TITLED_SECTION_OUTPUT.read_text()
    assert_html_equiv(actual, expected)
Beispiel #3
0
def test_alternative_multi_section():
    '''
    Multiple markdown files in a folder can be loaded as a single presentation.
    '''
    prez = Presentation(SECTIONS_DIR,
                        config_file=SECTIONS_DIR / 'alternative_sections.yaml')
    actual = prez.to_html()
    expected = ALTERNATIVE_SECTION_OUTPUT.read_text()
    assert_html_equiv(actual, expected)
Beispiel #4
0
def test_with_custom_css():
    '''
    Custom CSS is inserted as expected.
    '''
    prez = Presentation(DEFAULT_SLIDES_PATH,
                        stylesheet=CUSTOM_CSS_PATH,
                        title='Check out this Style')
    actual = prez.to_html()
    expected = CUSTOM_CSS_OUTPUT.read_text()
    assert_html_equiv(actual, expected)
Beispiel #5
0
def test_default_output():
    p = Presentation(DEFAULT_SLIDES_PATH)
    actual = p.to_html()
    expected = DEFAULT_OUTPUT.read_text()
    assert_html_equiv(actual, expected)
Beispiel #6
0
def test_equality():
    default_prez = Presentation(DEFAULT_SLIDES_PATH)
    assert default_prez == Presentation(DEFAULT_SLIDES_PATH)
    custom_css_prez = Presentation(DEFAULT_SLIDES_PATH, stylesheet=CUSTOM_CSS)
    assert default_prez != custom_css_prez
Beispiel #7
0
def test_str_and_path_md_is_same():
    p1 = Presentation(DEFAULT_SLIDES_PATH)
    with open(DEFAULT_SLIDES_PATH, 'r') as f:
        slide_md = f.read()
    p2 = Presentation(markdown=slide_md)
    assert p1 == p2