コード例 #1
0
    def test_correction(self):
        strategy = {
            'strategy':
            ((1, 95, 105), (2, 80, 110), (3, 5, 80, 95), (6, 10, 110, 140)),
            'correction': (3, 2)
        }
        history = [(100, 100), (100, 100), (100, 110), (100, 110), (100, 110),
                   (100, None)]
        pay = rc.count(strategy, history)
        self.assertIn(pay, range(50, 101))

        history = [(100, 100), (100, 100), (100, 90), (100, 90), (100, None)]
        pay = rc.count(strategy, history)
        self.assertIn(pay, range(100, 151))
コード例 #2
0
 def test_func(self):
     strategy = {
         'strategy':
         ((1, 95, 105), (2, 80, 110), (3, 5, 80, 110), (6, 10, 20, 30))
     }
     history = [(100, 100), (100, 100), (100, 100), (100, 100), (100, 100),
                (100, None)]
     pay = rc.count(strategy, history)
     self.assertIn(pay, range(20, 31))
コード例 #3
0
 def test_strategy_not_found(self):
     strategy = {'strategy': ((1, 95, 105), (2, 80, 110), (3, 5, 80, 110))}
     history = [(100, 100), (100, 100), (100, 100), (100, 100), (100, 100),
                (100, None)]
     pay = rc.count(strategy, history)
     self.assertIn(pay, range(70, 121))
コード例 #4
0
 def test_no_history(self):
     strategy = {'strategy': ((1, 95, 105), )}
     history = [(100, None)]
     pay = rc.count(strategy, history)
     self.assertIn(pay, range(90, 111))
コード例 #5
0
 def test_no_data(self):
     history = []
     with self.assertRaises(ValueError):
         rc.count(None, history)