@pytest.mark.parametrize('arg_count', [1, 2, 4])
    def test_unique_type(self, arg_count):
        class TestClass(object):
            __metaclass__ = UniqueType

            def __init__(self, *args):
                self.args = args

        argset = set()
        instances = []

        for i in xrange(50):
            args = tuple(randint(0, 4) for i in xrange(randint(0, arg_count)))
            argset.add(args)

            instance = TestClass(*args)
            assert hasattr(instance, 'args')
            assert instance.args == args
            instances.append(instance)

        for args in argset:
            argid = id(TestClass(*args))

            assert all(id(instance) == argid 
                       for instance in instances
                       if instance.args == args)
dataset/ETHPy150Open geky/pyDAPLink/pyDAPLink/test/test_utility.py/TestUniqueType.test_unique_type/original