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

from __future__ import print_function
from sfm.fingerprint import is_py2, fingerprint
from sfm.packages.six import integer_types


def test_hash_anything():
    """This test may failed in different operation system.
    """
    a_bytes = bytes(123)
    a_text = "Hello World!"
    a_pyobj = {"key": "value"}
    a_file = __file__.replace("test_fingerprint.py", "test_all.py")

    print(fingerprint.of_bytes(a_bytes))
    print(fingerprint.of_text(a_text))
    print(fingerprint.of_pyobj(a_pyobj))
    print(fingerprint.of_file(a_file))

    fingerprint.set_return_int()<commit_msg>2016-07-28<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import print_function
from sfm.fingerprint import is_py2, fingerprint
from sfm.packages.six import integer_types


def test_hash_anything():
    """This test may failed in different operation system.
    """
    a_bytes = bytes(123)
    a_text = "Hello World!"
    a_pyobj = {"key": "value"}
    a_file = __file__.replace("test_fingerprint.py", "test_all.py")

    print(fingerprint.of_bytes(a_bytes))
    print(fingerprint.of_text(a_text))
    print(fingerprint.of_pyobj(a_pyobj))
    assert fingerprint.of_file(a_file) == "b8a17e5c1927a21a95263fccbf0af7d4"

    fingerprint.set_return_int()
{'fraction_non_alphanumeric': 0.12396069538926682, 'fraction_numerical': 0.027210884353741496, 'mean_word_length': 4.426229508196721, 'pattern_counts': {'":': 2, '<': 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': '2980315', 'n_tokens_mistral': 500, 'n_tokens_neox': 459, 'n_words': 87}