<commit_before>import os
import io
import nose.tools as nt
from nbconvert import *
from nose.tools import nottest


def test_evens():
    ###### 
    # for now, we don't need to really run inkscape to extract svg 
    # from file, on unix, for test, we monkeypathc it to 'true'
    # which does not fail as doing anything.
    ####
    ConverterLaTeX.inkscape = 'true'

    converters = [(ConverterRST,'rst'),
                  (ConverterMarkdown,'md'),
                  (ConverterLaTeX,'tex'),
                  (ConverterPy,'py'),
                  (ConverterHTML,'html')
                ]
    reflist = [
            'tests/ipynbref/IntroNumPy.orig'
            ]
    for root in reflist :
        for conv,ext in converters:
            yield test_conversion, conv,root+'.ipynb',root+'.'+ext

@nottest
def test_conversion(ConverterClass, ipynb, ref_file):

    converter = ConverterClass(ipynb)
    converter.read()
    cv =converter.convert()
    with io.open(ref_file) as ref:
        value = ref.read()
        nt.assert_equal(cv.split('\n'),value.split('\n'))
    
<commit_msg>fix test for pandoc 1.9.3<commit_after>import os
import io
import nose.tools as nt
from nbconvert import *
from nose.tools import nottest


def test_evens():
    ###### 
    # for now, we don't need to really run inkscape to extract svg 
    # from file, on unix, for test, we monkeypathc it to 'true'
    # which does not fail as doing anything.
    ####
    ConverterLaTeX.inkscape = 'true'

    converters = [(ConverterRST,'rst'),
                  (ConverterMarkdown,'md'),
                  (ConverterLaTeX,'tex'),
                  (ConverterPy,'py'),
                  (ConverterHTML,'html')
                ]
    reflist = [
            'tests/ipynbref/IntroNumPy.orig'
            ]
    for root in reflist :
        for conv,ext in converters:
            yield test_conversion, conv,root+'.ipynb',root+'.'+ext

@nottest
def compfiles(stra, strb):
    nt.assert_equal(map(unicode.strip,stra.split('\n')),map(unicode.strip,strb.split('\n')))

@nottest
def test_conversion(ConverterClass, ipynb, ref_file):

    converter = ConverterClass(ipynb)
    converter.read()
    cv =converter.convert()
    with io.open(ref_file) as ref:
        value = ref.read()
        compfiles(cv,value)
    

{'fraction_non_alphanumeric': 0.12084063047285463, 'fraction_numerical': 0.0013134851138353765, 'mean_word_length': 2.365243004418262, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '5362524', 'n_tokens_mistral': 744, 'n_tokens_neox': 710, 'n_words': 179}