def testEnabledPromotedAndDisabledExperiment(self):
        # enabled test, new user (prove we get both results)
        experiment = Experiment(name="enabled")
        experiment.save()
        experiment.state = Experiment.ENABLED_STATE
        experiment.save()
        test_user = None
        control_user = None
        for i in range(100):
            user = TestUser(username="user%s" % i)
            in_test = Experiment.test("enabled", user)
            in_control = Experiment.control("enabled", user)
            self.assertNotEqual(in_test, in_control)
            self.assertEqual(in_test, Experiment.test("enabled", user))
            self.assertEqual(in_control, Experiment.control("enabled", user))
            if in_test:
                test_user = user
            if in_control:
                control_user = user

        self.assertNotEqual(None, test_user)
        self.assertNotEqual(None, control_user)
        self.assertNotEqual(test_user, control_user)

        # promoted test with an enrolled user
        # (prove we get both results, then that all users are in test)
        experiment.state = Experiment.PROMOTED_STATE
        experiment.save()

        self.assertFalse(Experiment.control("enabled", control_user))
        self.assertFalse(Experiment.control("enabled", test_user))
        self.assertTrue(Experiment.test("enabled", control_user))
        self.assertTrue(Experiment.test("enabled", test_user))

        # disabled test with an enrolled user
        # (prove we get both results, then that all users are in control)
        experiment.state = Experiment.DISABLED_STATE
        experiment.save()

        self.assertTrue(Experiment.control("enabled", control_user))
        self.assertTrue(Experiment.control("enabled", test_user))
        self.assertFalse(Experiment.test("enabled", control_user))
        self.assertFalse(Experiment.test("enabled", test_user))
dataset/ETHPy150Open MontmereLimited/django-lean/django_lean/experiments/tests/test_participants.py/TestParticipants.testEnabledPromotedAndDisabledExperiment/original