Exemple #1
0
 def is_pa_terminal(cls, ball_tally, strike_tally, pitch_res, event_cd):
     """
     Is PA terminal
     :param ball_tally: Ball telly
     :param strike_tally: Strike telly
     :param pitch_res: pitching result(Retrosheet format)
     :param event_cd: Event code
     :return: FLG(T or F)
     """
     if RetroSheet.is_pa_terminal(ball_tally, strike_tally, pitch_res, event_cd):
         return MlbamConst.FLG_TRUE
     return MlbamConst.FLG_FALSE
Exemple #2
0
 def is_pa_terminal(cls, ball_tally, strike_tally, pitch_res, event_cd):
     """
     Is PA terminal
     :param ball_tally: Ball telly
     :param strike_tally: Strike telly
     :param pitch_res: pitching result(Retrosheet format)
     :param event_cd: Event code
     :return: FLG(T or F)
     """
     if RetroSheet.is_pa_terminal(ball_tally, strike_tally, pitch_res,
                                  event_cd):
         return MlbamConst.FLG_TRUE
     return MlbamConst.FLG_FALSE
 def test_pa_terminal(self):
     """
     PA terminal
     """
     # In Play
     self.assertTrue(RetroSheet.is_pa_terminal(0, 0, 'X', 3))
     self.assertTrue(RetroSheet.is_pa_terminal(0, 1, 'X', 20))
     self.assertTrue(RetroSheet.is_pa_terminal(1, 2, 'X', 21))
     self.assertTrue(RetroSheet.is_pa_terminal(2, 2, 'X', 22))
     self.assertTrue(RetroSheet.is_pa_terminal(3, 2, 'X', 23))
     # Strike Out(Strike or Call)
     self.assertTrue(RetroSheet.is_pa_terminal(0, 2, 'S', 3))
     self.assertTrue(RetroSheet.is_pa_terminal(1, 2, 'S', 3))
     self.assertTrue(RetroSheet.is_pa_terminal(2, 2, 'S', 3))
     self.assertTrue(RetroSheet.is_pa_terminal(3, 2, 'S', 3))
     self.assertTrue(RetroSheet.is_pa_terminal(0, 2, 'C', 3))
     self.assertTrue(RetroSheet.is_pa_terminal(1, 2, 'C', 3))
     self.assertTrue(RetroSheet.is_pa_terminal(2, 2, 'C', 3))
     self.assertTrue(RetroSheet.is_pa_terminal(3, 2, 'C', 3))
     # Not Strike Out
     self.assertFalse(RetroSheet.is_pa_terminal(0, 1, 'S', 3))
     self.assertFalse(RetroSheet.is_pa_terminal(1, 1, 'S', 3))
     self.assertFalse(RetroSheet.is_pa_terminal(2, 1, 'S', 3))
     self.assertFalse(RetroSheet.is_pa_terminal(3, 1, 'S', 3))
     self.assertFalse(RetroSheet.is_pa_terminal(0, 0, 'C', 3))
     self.assertFalse(RetroSheet.is_pa_terminal(1, 0, 'C', 3))
     self.assertFalse(RetroSheet.is_pa_terminal(2, 0, 'C', 3))
     self.assertFalse(RetroSheet.is_pa_terminal(3, 0, 'C', 3))
     # Walk(Ball or Intent Ball)
     self.assertTrue(RetroSheet.is_pa_terminal(3, 0, 'B', 14))
     self.assertTrue(RetroSheet.is_pa_terminal(3, 1, 'B', 14))
     self.assertTrue(RetroSheet.is_pa_terminal(3, 2, 'B', 14))
     self.assertTrue(RetroSheet.is_pa_terminal(3, 0, 'B', 15))
     self.assertTrue(RetroSheet.is_pa_terminal(3, 1, 'B', 15))
     self.assertTrue(RetroSheet.is_pa_terminal(3, 2, 'B', 15))
     # Not Walk
     self.assertFalse(RetroSheet.is_pa_terminal(2, 0, 'B', 14))
     self.assertFalse(RetroSheet.is_pa_terminal(1, 1, 'B', 14))
     self.assertFalse(RetroSheet.is_pa_terminal(0, 2, 'B', 14))
     self.assertFalse(RetroSheet.is_pa_terminal(2, 0, 'B', 15))
     self.assertFalse(RetroSheet.is_pa_terminal(1, 1, 'B', 15))
     self.assertFalse(RetroSheet.is_pa_terminal(0, 2, 'B', 15))
 def test_pa_terminal(self):
     """
     PA terminal
     """
     # In Play
     self.assertTrue(RetroSheet.is_pa_terminal(0, 0, 'X', 3))
     self.assertTrue(RetroSheet.is_pa_terminal(0, 1, 'X', 20))
     self.assertTrue(RetroSheet.is_pa_terminal(1, 2, 'X', 21))
     self.assertTrue(RetroSheet.is_pa_terminal(2, 2, 'X', 22))
     self.assertTrue(RetroSheet.is_pa_terminal(3, 2, 'X', 23))
     # Strike Out(Strike or Call)
     self.assertTrue(RetroSheet.is_pa_terminal(0, 2, 'S', 3))
     self.assertTrue(RetroSheet.is_pa_terminal(1, 2, 'S', 3))
     self.assertTrue(RetroSheet.is_pa_terminal(2, 2, 'S', 3))
     self.assertTrue(RetroSheet.is_pa_terminal(3, 2, 'S', 3))
     self.assertTrue(RetroSheet.is_pa_terminal(0, 2, 'C', 3))
     self.assertTrue(RetroSheet.is_pa_terminal(1, 2, 'C', 3))
     self.assertTrue(RetroSheet.is_pa_terminal(2, 2, 'C', 3))
     self.assertTrue(RetroSheet.is_pa_terminal(3, 2, 'C', 3))
     # Not Strike Out
     self.assertFalse(RetroSheet.is_pa_terminal(0, 1, 'S', 3))
     self.assertFalse(RetroSheet.is_pa_terminal(1, 1, 'S', 3))
     self.assertFalse(RetroSheet.is_pa_terminal(2, 1, 'S', 3))
     self.assertFalse(RetroSheet.is_pa_terminal(3, 1, 'S', 3))
     self.assertFalse(RetroSheet.is_pa_terminal(0, 0, 'C', 3))
     self.assertFalse(RetroSheet.is_pa_terminal(1, 0, 'C', 3))
     self.assertFalse(RetroSheet.is_pa_terminal(2, 0, 'C', 3))
     self.assertFalse(RetroSheet.is_pa_terminal(3, 0, 'C', 3))
     # Walk(Ball or Intent Ball)
     self.assertTrue(RetroSheet.is_pa_terminal(3, 0, 'B', 14))
     self.assertTrue(RetroSheet.is_pa_terminal(3, 1, 'B', 14))
     self.assertTrue(RetroSheet.is_pa_terminal(3, 2, 'B', 14))
     self.assertTrue(RetroSheet.is_pa_terminal(3, 0, 'B', 15))
     self.assertTrue(RetroSheet.is_pa_terminal(3, 1, 'B', 15))
     self.assertTrue(RetroSheet.is_pa_terminal(3, 2, 'B', 15))
     # Not Walk
     self.assertFalse(RetroSheet.is_pa_terminal(2, 0, 'B', 14))
     self.assertFalse(RetroSheet.is_pa_terminal(1, 1, 'B', 14))
     self.assertFalse(RetroSheet.is_pa_terminal(0, 2, 'B', 14))
     self.assertFalse(RetroSheet.is_pa_terminal(2, 0, 'B', 15))
     self.assertFalse(RetroSheet.is_pa_terminal(1, 1, 'B', 15))
     self.assertFalse(RetroSheet.is_pa_terminal(0, 2, 'B', 15))