Example #1
0
 def test_history_penalty(self):
     config = Config()
     config.add_place('Sisaket', .7)
     session = Session(config, .8)
     session.join(User('test'))
     old_weights = session._calc_weights()
     config.add_winner('Sisaket')
     new_weights = session._calc_weights()
     self.assertGreater(old_weights['Sisaket'], new_weights['Sisaket'])
Example #2
0
 def test_history_crop(self):
     file = NamedTemporaryFile().name
     config = Config(file)
     for i in range(10):
         config.add_winner('Sisaket')
     config.save()
     config = Config(file)
     config.load()
     self.assertEqual(7, len(config._history))
Example #3
0
 def test_history_penalty(self):
     config = Config()
     config.add_place('Sisaket', .7)
     session = Session(config, .8)
     session.join(User('test'))
     old_weights = session._calc_weights()
     config.add_winner('Sisaket')
     new_weights = session._calc_weights()
     self.assertGreater(old_weights['Sisaket'], new_weights['Sisaket'])
Example #4
0
 def test_history_crop(self):
     file = NamedTemporaryFile().name
     config = Config(file)
     for i in range(10):
         config.add_winner('Sisaket')
     config.save()
     config = Config(file)
     config.load()
     self.assertEqual(7, len(config._history))