Ejemplo n.º 1
0
 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')
Ejemplo n.º 2
0
 def assign(self, params, i):
     params.foo = UniformChoice(choices=['a', 'b'], unit=i)
     self._in_experiment = False
Ejemplo n.º 3
0
 def assign(self, params, i, counter):
     params.foo = UniformChoice(choices=['a', 'b'], unit=i)
     counter['count'] = counter.get('count', 0) + 1
Ejemplo n.º 4
0
 def assign(self, params, i):
     params.foo = UniformChoice(choices=['a', 'b'], unit=i)
Ejemplo n.º 5
0
 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)