<commit_before>#!/usr/bin/env python
"""
This is the test case for the savefile.
"""

import binascii
import unittest

from pcapfile.protocols.linklayer import ethernet

# a sample ethernet frame carrying an IPv4 SYN request
TEST_PACKET = [b'010203040506ffeeddccbbaa08004500003cc43800003806',
               b'2898adc22552c0a8022f0050f9dc06511a336489a374a012',
               b'37641b070000020405960402080a2195430027e3b0900103',
               b'0306']
TEST_PACKET = binascii.unhexlify(b''.join(TEST_PACKET))

def str_to_ethaddr(x):
    return binascii.unhexlify(x.translate(None, ':'))

<commit_msg>Fix tests for py3<commit_after>#!/usr/bin/env python
"""
This is the test case for the savefile.
"""

import binascii
import unittest

from pcapfile.protocols.linklayer import ethernet

# a sample ethernet frame carrying an IPv4 SYN request
TEST_PACKET = [b'010203040506ffeeddccbbaa08004500003cc43800003806',
               b'2898adc22552c0a8022f0050f9dc06511a336489a374a012',
               b'37641b070000020405960402080a2195430027e3b0900103',
               b'0306']
TEST_PACKET = binascii.unhexlify(b''.join(TEST_PACKET))


def str_to_ethaddr(x):
    return binascii.unhexlify(x.replace(':', ''))


{'fraction_non_alphanumeric': 0.09159034138218151, 'fraction_numerical': 0.1990008326394671, 'mean_word_length': 4.4389140271493215, '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': '3097879', 'n_tokens_mistral': 603, 'n_tokens_neox': 449, 'n_words': 79}