<commit_before>"""Tests the singleton class of pyexperiment

Written by <NAME>
"""

import unittest
from pyexperiment.utils.Singleton import Singleton, SingletonIndirector


class TestSingleton(unittest.TestCase):
    """Test the Singleton class/mixin
    """
    def test_singleton_subclass(self):
        """Test that subclasses of Singleton always return same instance
        """
        class SingletonTest(Singleton):
            """Singleton test class
            """
            pass

        singleton_a = SingletonTest.get_instance()
        singleton_b = SingletonTest.get_instance()
        self.assertEqual(singleton_a, singleton_b)

    def test_singleton_resets(self):
        """Test that singletons properly reset themselves.
        """<commit_msg>Add future imports to Singleton tests<commit_after>"""Tests the singleton class of pyexperiment

Written by <NAME>
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import


import unittest
from pyexperiment.utils.Singleton import Singleton, SingletonIndirector


class TestSingleton(unittest.TestCase):
    """Test the Singleton class/mixin
    """
    def test_singleton_subclass(self):
        """Test that subclasses of Singleton always return same instance
        """
        class SingletonTest(Singleton):
            """Singleton test class
            """
            pass

        singleton_a = SingletonTest.get_instance()
        singleton_b = SingletonTest.get_instance()
        self.assertEqual(singleton_a, singleton_b)

    def test_singleton_resets(self):
        """Test that singletons properly reset themselves.
        """
{'fraction_non_alphanumeric': 0.07611241217798595, 'fraction_numerical': 0.0, 'mean_word_length': 3.2618453865336656, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '321585', 'n_tokens_mistral': 460, 'n_tokens_neox': 441, 'n_words': 127}