<commit_before># -*- coding: utf 8 -*-
"""
Defines a suite a tests for images run with:

    py.test --mpl-generate-path=tests/generated

https://pypi.python.org/pypi/pytest-mpl/0.3
"""
from striplog import Striplog
from striplog import Legend, Component, Decor

import pytest
import matplotlib
matplotlib.use('Agg')


@pytest.mark.mpl_image_compare
def test_striplog_plot():
    """
    Tests mpl image of striplog
    """
    legend = Legend.default()

    imgfile = "tutorial/M-MG-70_14.3_135.9.png"

    striplog = Striplog.from_img(imgfile, 14.3, 135.9, legend=legend)

    fig = striplog.thickest(n=5).plot(legend=legend)
    return fig


@pytest.mark.mpl_image_compare
def test_decor_plot():
    """
    Tests mpl image of decor
    """
    r = {'colour': 'grey',
         'grainsize': 'vf-f',
         'lithology': 'sand'}

    rock = Component(r)

    d = {'color': '#86F0B6',
         'component': rock,
         'width': 3}

    decor = Decor(d)
    print(decor.component.summary())
    fig = decor.plot(fmt="{lithology} {colour} {grainsize}")
    return fig
<commit_msg>travis might work now ii<commit_after># -*- coding: utf 8 -*-
"""
Defines a suite a tests for images run with:

    py.test --mpl-generate-path=tests/generated

https://pypi.python.org/pypi/pytest-mpl/0.3
"""
from striplog import Striplog
from striplog import Legend, Component, Decor

import pytest


@pytest.mark.mpl_image_compare
def test_striplog_plot():
    """
    Tests mpl image of striplog
    """
    legend = Legend.default()

    imgfile = "tutorial/M-MG-70_14.3_135.9.png"

    striplog = Striplog.from_img(imgfile, 14.3, 135.9, legend=legend)

    fig = striplog.thickest(n=5).plot(legend=legend)
    return fig


@pytest.mark.mpl_image_compare
def test_decor_plot():
    """
    Tests mpl image of decor
    """
    r = {'colour': 'grey',
         'grainsize': 'vf-f',
         'lithology': 'sand'}

    rock = Component(r)

    d = {'color': '#86F0B6',
         'component': rock,
         'width': 3}

    decor = Decor(d)
    print(decor.component.summary())
    fig = decor.plot(fmt="{lithology} {colour} {grainsize}")
    return fig

{'fraction_non_alphanumeric': 0.1484777517564403, 'fraction_numerical': 0.0234192037470726, 'mean_word_length': 2.992523364485981, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6469605', 'n_tokens_mistral': 837, 'n_tokens_neox': 768, 'n_words': 171}