<commit_before># coding=utf-8

from __future__ import unicode_literals

__loader__ = None

import datetime
import json
import os
import random
import time
import unittest
import sys

try:
    from StringIO import StringIO
except ImportError:
    from io import StringIO

from faker import Generator, Factory
from faker.utils import text, decorators

try:
    string_types = (basestring,)
except NameError:
    string_types = (str,)


TEST_DIR = os.path.dirname(__file__)


class BarProvider(object):
    def foo_formatter(self):
        return 'barfoo'


class FooProvider(object):
    def foo_formatter(self):
        return 'foobar'

    def foo_formatter_with_arguments(self, param='', append=''):
        return 'baz' + param + append


class ShimsTestCase(unittest.TestCase):
    def test_counter(self):
        from faker.shims import Counter

        result = Counter('abbb') + Counter('bcc')
        self.assertEqual(result, Counter({'b': 4, 'c': 2, 'a': 1}))

        result = Counter('abbbc') - Counter('bccd')
        self.assertEqual(result, Counter({'b': 2, 'a': 1}))

        result = Counter('abbb') | Counter('bcc')
        self.assertEqual(result, Counter({'b': 3, 'c': 2, 'a': 1}))

        result = Counter('abbb') & Counter('bcc')
        self.assertEqual(result, Counter({'b': 1}))

        result = Counter('abracadabra').most_common(3)
        self.assertEqual(result, [('a', 5), ('r', 2), ('b', 2)])

        result = sorted(Counter('ABCABC').elements())
        self.assertEqual(result, ['A', 'A', 'B', 'B', 'C', 'C'])

        counter = Counter('which')
        counter.update('witch')
        d = Counter('watch')
        counter.update(d)
        self.assertEqual(counter['h'], 4)<commit_msg>fix counter shin tests for python 3<commit_after># coding=utf-8

from __future__ import unicode_literals

__loader__ = None

import datetime
import json
import os
import random
import time
import unittest
import sys

try:
    from StringIO import StringIO
except ImportError:
    from io import StringIO

from faker import Generator, Factory
from faker.utils import text, decorators

try:
    string_types = (basestring,)
except NameError:
    string_types = (str,)


TEST_DIR = os.path.dirname(__file__)


class BarProvider(object):
    def foo_formatter(self):
        return 'barfoo'


class FooProvider(object):
    def foo_formatter(self):
        return 'foobar'

    def foo_formatter_with_arguments(self, param='', append=''):
        return 'baz' + param + append


class ShimsTestCase(unittest.TestCase):
    def test_counter(self):
        from faker.shims import Counter

        result = Counter('abbb') + Counter('bcc')
        self.assertEqual(result, Counter({'b': 4, 'c': 2, 'a': 1}))

        result = Counter('abbbc') - Counter('bccd')
        self.assertEqual(result, Counter({'b': 2, 'a': 1}))

        result = Counter('abbb') | Counter('bcc')
        self.assertEqual(result, Counter({'b': 3, 'c': 2, 'a': 1}))

        result = Counter('abbb') & Counter('bcc')
        self.assertEqual(result, Counter({'b': 1}))

        result = sorted(Counter('abracadabra').most_common(3))
        self.assertEqual(result, [('a', 5), ('b', 2), ('r', 2)])

        result = sorted(Counter('ABCABC').elements())
        self.assertEqual(result, ['A', 'A', 'B', 'B', 'C', 'C'])

        counter = Counter('which')
        counter.update('witch')
        d = Counter('watch')
        counter.update(d)
        self.assertEqual(counter['h'], 4)
{'fraction_non_alphanumeric': 0.15043227665706052, 'fraction_numerical': 0.008933717579250721, 'mean_word_length': 3.3333333333333335, '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': '1424129', 'n_tokens_mistral': 1164, 'n_tokens_neox': 1058, 'n_words': 285}