<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

__author__ = 'johnnycakes79'
"""
test_epys
----------------------------------

Tests for `epys` module.
"""

# import pytest
import os

import epys as ep


this_dir, this_filename = os.path.split(__file__)
parent_dir = os.path.abspath(os.path.join(this_dir, os.pardir))
_datarateFile = os.path.join(parent_dir, "sample_data/data_rate_avg.out")


# --- epys.read ---
def test_epys_read_datarate_data_shape():
    data, header, meta = ep.read.datarate(_datarateFile, metadata=True)
    assert data.shape == (366, 52)
    data, header, meta = ep.read.datarate(_datarateFile, metadata=True,
                                          pandas=False)
    assert data.shape == (366, 53)


def test_epys_read_datarate_meta_length():
    data, header, meta = ep.read.datarate(_datarateFile, metadata=True)
    assert len(meta) == 16


def test_epys_read_datarate_header_length():
    data, header, meta = ep.read.datarate(_datarateFile, metadata=True)
    assert len(header) == 53<commit_msg>pandas and numpy tests for read.datarate split into 2<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

__author__ = 'johnnycakes79'
"""
test_epys
----------------------------------

Tests for `epys` module.
"""

# import pytest
import os

import epys as ep


this_dir, this_filename = os.path.split(__file__)
parent_dir = os.path.abspath(os.path.join(this_dir, os.pardir))
_datarateFile = os.path.join(parent_dir, "sample_data/data_rate_avg.out")


# --- epys.read ---
def test_epys_read_datarate_data_shape_numpy():
    data, header, meta = ep.read.datarate(_datarateFile, metadata=True,
                                          pandas=False)
    assert data.shape == (366, 53)


def test_epys_read_datarate_data_shape_pandas():
    data, header, meta = ep.read.datarate(_datarateFile, metadata=True)
    assert data.shape == (366, 52)


def test_epys_read_datarate_meta_length():
    data, header, meta = ep.read.datarate(_datarateFile, metadata=True)
    assert len(meta) == 16


def test_epys_read_datarate_header_length():
    data, header, meta = ep.read.datarate(_datarateFile, metadata=True)
    assert len(header) == 53
{'fraction_non_alphanumeric': 0.1539166284928997, 'fraction_numerical': 0.01603298213467705, 'mean_word_length': 3.2823529411764705, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '466000', 'n_tokens_mistral': 804, 'n_tokens_neox': 735, 'n_words': 149}