def test_set_get_uniform(self): a = Assignment(self.tester_salt) a.foo = UniformChoice(choices=['a', 'b'], unit=self.tester_unit) a.bar = UniformChoice(choices=['a', 'b'], unit=self.tester_unit) a.baz = UniformChoice(choices=['a', 'b'], unit=self.tester_unit) self.assertEqual(a.foo, 'b') self.assertEqual(a.bar, 'a') self.assertEqual(a.baz, 'a')
def assign(self, params, i): params.foo = UniformChoice(choices=['a', 'b'], unit=i) self._in_experiment = False
def assign(self, params, i, counter): params.foo = UniformChoice(choices=['a', 'b'], unit=i) counter['count'] = counter.get('count', 0) + 1
def assign(self, params, i): params.foo = UniformChoice(choices=['a', 'b'], unit=i)
def test_custom_salt(self): a = Assignment(self.tester_salt) custom_salt = lambda x,y: '%s-%s' % (x,y) a.foo = UniformChoice(choices=list(range(8)), unit=self.tester_unit) self.assertEqual(a.foo, 7)