<commit_before>import pytest
from path import path

from pynpact import parsing, genbank


def test_initial(gbkfile):
    result = parsing.initial(gbkfile)
    assert 'outputdir' in result
    assert result['filename'] == gbkfile
    assert 'basename' in result

def detect_format(config):
    parsing.detect_format(config)
    assert config['format']
    ddnafile = path(config['ddna'])
    assert ddnafile.exists()
    assert config['length'] == ddnafile.size

def test_detect_gbkformat(gbkconfig):
    detect_format(gbkconfig)

def test_detect_fnaformat(fnaconfig):
    detect_format(fnaconfig)

def test_detect_rawformat(rawconfig):
    detect_format(rawconfig)

def test_genbank(gbkfile):
    seqrec = genbank.parse_seq_rec(gbkfile)
    assert seqrec<commit_msg>More detect_format tests<commit_after>import pytest
from path import path

from pynpact import parsing, genbank


def test_initial(gbkfile):
    result = parsing.initial(gbkfile)
    assert 'outputdir' in result
    assert result['filename'] == gbkfile
    assert 'basename' in result

def detect_format(config):
    parsing.detect_format(config)
    assert config['format']
    ddnafile = path(config['ddna'])
    assert ddnafile.exists()
    assert config['length'] == ddnafile.size
    assert ddnafile.open('r').read(14) == 'CAAATTGCGCTACA'

def test_detect_gbkformat(gbkconfig):
    detect_format(gbkconfig)

def test_detect_fnaformat(fnaconfig):
    detect_format(fnaconfig)

def test_detect_rawformat(rawconfig):
    detect_format(rawconfig)

def test_genbank(gbkfile):
    seqrec = genbank.parse_seq_rec(gbkfile)
    assert seqrec
{'fraction_non_alphanumeric': 0.09476309226932668, 'fraction_numerical': 0.0012468827930174563, 'mean_word_length': 5.056603773584905, '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': '797325', 'n_tokens_mistral': 545, 'n_tokens_neox': 528, 'n_words': 110}