Пример #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')
Пример #2
0
    def test_custom_salt(self):
        a = Assignment(self.tester_salt)
	custom_salt = lambda x,y: '%s-%s' % (x,y)
        a.foo = UniformChoice(choices=range(8), unit=self.tester_unit)
        self.assertEqual(a.foo, 7)
Пример #3
0
 def test_set_get_constant(self):
     a = Assignment(self.tester_salt)
     a.foo = 12
     self.assertEqual(a.foo, 12)
Пример #4
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)