Ejemplo n.º 1
0
 def test_compare_normal(self):
     self.assertEqual(Odds.fractional('1/2') == 1.5, True)
     self.assertEqual(Odds.fractional('2/1') == 3.0, True)
     self.assertTrue(Odds.fractional('2/1') == Odds.fractional('2/1'))
     self.assertEqual(Odds(1.5) < 1, False)
     self.assertEqual(Odds(0.5) > 1, False)
     self.assertEqual(Odds(1.5) != 1.0, True)
     self.assertEqual(Odds(1.5) != 1.5, False)
Ejemplo n.º 2
0
    def test_fulfill_placement(self):
        self.assertFalse(
            Bet(100, home=Odds(2.4), draw=Odds(3.1),
                away=Odds(3.7)).fulfill_placement())

        b = Bet(100, home=Odds(2.47), draw=Odds(3.1), away=Odds(3.7))
        self.assertTrue(b.fulfill_placement())

        details = [
            BetDetail(name='home', placed=40.52, outcome=100.49),
            BetDetail(name='away', placed=27.13, outcome=100.66),
            BetDetail(name='draw', placed=32.35, outcome=100.61)
        ]
        placements = b.placements
        s = 0.0

        for detail in details:
            for p in placements:
                if (p.name == detail.name and p.placed == detail.placed
                        and p.outcome == detail.outcome):
                    placements.remove(p)
                    s += p.placed

        self.assertTrue(len(placements) == 0)
        self.assertEqual(b.bet, b.sum_placed)
        self.assertEqual(b.sum_placed, s)
Ejemplo n.º 3
0
 def test_break_even(self):
     self.assertTrue(
         Bet(100, home=Odds(2.47), draw=Odds(3.1),
             away=Odds(3.7)).break_even())
     self.assertFalse(
         Bet(100, home=Odds(2.0), draw=Odds(3.1),
             away=Odds(3.7)).break_even())
Ejemplo n.º 4
0
 def test_should_not_error(self):
     Bet(100, home=Odds(2), draw=Odds(3.1), away=Odds(3.7))
Ejemplo n.º 5
0
 def test_malay(self):
     for bet in all_odds:
         conv, dec = bet.malay, bet.decimal
         o = Odds.malay(conv)
         self.assertEqual(o.decimal, dec)
Ejemplo n.º 6
0
 def test_indo(self):
     for bet in all_odds:
         conv, dec = bet.indo, bet.decimal
         o = Odds.indo(conv)
         self.assertEqual(o.decimal, dec,
                          msg='conv: {0} = dec: {1}'.format(conv, dec))
Ejemplo n.º 7
0
 def test_fractional(self):
     for bet in all_odds:
         conv, dec = bet.fractional, bet.decimal
         o = Odds.fractional(conv)
         self.assertEqual(o.decimal, dec,
                          msg='conv: {0} = dec: {1}'.format(conv, dec))