示例#1
0
    def test_get_min_accepted_performance(self):
        # given
        p = Performance(environment_id=Environment.get_id(),
                        min_accepted_step=100)
        p.save()
        MinPerformanceMultiplier.set(3.141)

        # then
        self.assertEqual(MinPerformanceMultiplier.get(), 3.141)
        self.assertEqual(self.env.get_min_accepted_performance(), 314.1)
 def test_above_max(self):
     with self.assertRaisesRegex(Exception, 'must be within'):
         MinPerformanceMultiplier.set(self.max + 2)
 def test_below_min(self):
     with self.assertRaisesRegex(Exception, 'must be within'):
         MinPerformanceMultiplier.set(self.min - 1)
 def test_max(self):
     MinPerformanceMultiplier.set(self.max)
     self.assertEqual(self.max, MinPerformanceMultiplier.get())
 def test_fractional(self):
     MinPerformanceMultiplier.set(3.1415)
     self.assertEqual(3.1415, MinPerformanceMultiplier.get())
 def test_min(self):
     MinPerformanceMultiplier.set(self.min)
     self.assertEqual(self.min, MinPerformanceMultiplier.get())