Exemple #1
0
def test_table_and_my_cards8():  # ok
    log = logging.getLogger(__name__)
    mongo = MongoManager()
    table_dict = mongo.get_table('GG_4TABLE')
    table_scraper = TableScraper(table_dict)

    table_scraper.screenshot = Image.open(os.path.join(os.environ['test_src1'], '20.png'))
    table_scraper.crop_from_top_left_corner2(select_table=0)
    table_scraper.is_my_turn()
    table_scraper.lost_everything()
    table_scraper.get_my_cards2()
    table_scraper.get_table_cards2()
    table_scraper.get_dealer_position2()
    table_scraper.get_players_in_game()
    table_scraper.get_pots()
    table_scraper.get_players_funds()
    table_scraper.get_player_pots()
    table_scraper.get_call_value()
    table_scraper.get_raise_value()
    # table_scraper.has_all_in_call_button()
    table_scraper.has_call_button()
    table_scraper.has_raise_button()

    assert set(table_scraper.my_cards) == set(['4S', '4C'])  # ok
    # assert table_scraper.player_funds == [13.0, 13.5, 148.5, 77.5, 98.0, 104.0]   #Actual   :[13.0, 13.5, 148.5, 77.5, 8.0, 104.0]
    assert table_scraper.player_pots == [1.0, 2.5, '', '', 2.5, 0.5]   # Actual   :['', '', 5.5, 0.0, '', '']
Exemple #2
0
def test_table_and_my_cards5():  # ok
    log = logging.getLogger(__name__)
    mongo = MongoManager()
    table_dict = mongo.get_table('GG_4TABLE')
    table_scraper = TableScraper(table_dict)

    table_scraper.screenshot = Image.open(os.path.join(os.environ['test_src1'], '4.png'))
    table_scraper.crop_from_top_left_corner2(select_table=0)
    table_scraper.is_my_turn()
    table_scraper.lost_everything()
    table_scraper.get_my_cards2()
    table_scraper.get_table_cards2()
    table_scraper.get_dealer_position2()
    table_scraper.get_players_in_game()
    table_scraper.get_pots()
    table_scraper.get_players_funds()
    table_scraper.get_player_pots()
    table_scraper.get_call_value()
    table_scraper.get_raise_value()
    # table_scraper.has_all_in_call_button()
    table_scraper.has_call_button()
    table_scraper.has_raise_button()

    print(f'My cards: {table_scraper.my_cards}')
    assert set(table_scraper.my_cards) == set(['9H', 'KD'])  # 8H duplicates 9H
    assert table_scraper.player_funds == [22.5, 141.5, 203.0, 71.0, 100.0, 100.0]
    assert table_scraper.player_pots == ['', 0.5, 1.0, '', '', '']   #  Actual   :['', 0.5, 1.0, 0.0, '', '']
Exemple #3
0
def test_table_and_my_cards4():  # ok
    log = logging.getLogger(__name__)
    mongo = MongoManager()
    table_dict = mongo.get_table('GG_4TABLE')
    table_scraper = TableScraper(table_dict)

    table_scraper.screenshot = Image.open(os.path.join(os.environ['test_src1'], '3.png'))
    table_scraper.crop_from_top_left_corner2(select_table=0)
    table_scraper.is_my_turn()
    table_scraper.lost_everything()
    table_scraper.get_my_cards2()
    table_scraper.get_table_cards2()
    table_scraper.get_dealer_position2()
    table_scraper.get_players_in_game()
    table_scraper.get_pots()
    table_scraper.get_players_funds()
    table_scraper.get_player_pots()
    table_scraper.get_call_value()
    table_scraper.get_raise_value()
    # table_scraper.has_all_in_call_button()
    table_scraper.has_call_button()
    table_scraper.has_raise_button()

    assert set(table_scraper.my_cards) == set(['AD', '9S']) # ok
    assert table_scraper.player_funds == [22.5, 134.5, 205.0, 71.0, 100.0, 100.0]
    assert table_scraper.player_pots == [0.5, 1.0, 1.0, 2.0, '', '']
Exemple #4
0
def test_table_and_my_cards1():  # ok
    log = logging.getLogger(__name__)
    mongo = MongoManager()
    table_dict = mongo.get_table('GG_4TABLE')
    table_scraper = TableScraper(table_dict)

    table_scraper.screenshot = Image.open(os.path.join(os.environ['test_src'], '1.png'))
    table_scraper.crop_from_top_left_corner2()
    table_scraper.is_my_turn()
    table_scraper.lost_everything()
    table_scraper.get_my_cards2()
    table_scraper.get_table_cards2()
    table_scraper.get_dealer_position2()
    table_scraper.get_players_in_game()
    table_scraper.get_pots()
    table_scraper.get_players_funds()
    table_scraper.get_player_pots()
    table_scraper.get_call_value()
    table_scraper.get_raise_value()
    # table_scraper.has_all_in_call_button()
    table_scraper.has_call_button()
    table_scraper.has_raise_button()

    assert set(table_scraper.my_cards) == set(['7H', 'AD']) # ok
    # assert table_scraper.table_cards == ['3H', '6H', 'JS']
    assert table_scraper.player_funds == [23.0, 100.0, 42.0, 23.0, 97.5, 102.0]
    assert table_scraper.player_pots == ['', '', 6.0, '', '', '']
def test_table_scraper():
    mongo = MongoManager()
    table_dict = mongo.get_table("PartyPoker 6 Players Fast Forward $1-$2 NL Hold'em")
    table_scraper = TableScraper(table_dict)
    table_scraper.screenshot = Image.open(os.path.join(get_dir('tests', 'screenshots'), '173280759_PreFlop_0.png'))
    table_scraper.crop_from_top_left_corner()
    table_scraper.is_my_turn()
    table_scraper.lost_everything()
    table_scraper.get_my_cards2()
    table_scraper.get_table_cards2()
    table_scraper.get_dealer_position2()
    table_scraper.get_players_in_game()
    table_scraper.get_pots()
    table_scraper.get_players_funds()
    table_scraper.get_call_value()
    table_scraper.get_raise_value()
    table_scraper.has_all_in_call_button()
    table_scraper.has_call_button()
    table_scraper.has_raise_button()
Exemple #6
0
def test_table_scraper():
    log = logging.getLogger(__name__)
    mongo = MongoManager()
    table_dict = mongo.get_table('GG_TEST')
    table_scraper = TableScraper(table_dict)
    table_scraper.screenshot = Image.open(os.path.join(os.environ['test_src'], 'Capture6.PNG'))
    table_scraper.crop_from_top_left_corner()
    log.info(f"Is my turn?{table_scraper.is_my_turn()}")
    table_scraper.lost_everything()
    table_scraper.get_my_cards2()
    table_scraper.get_table_cards2()
    table_scraper.get_dealer_position2()
    table_scraper.get_players_in_game()
    table_scraper.get_pots()
    table_scraper.get_players_funds()
    table_scraper.get_call_value()
    table_scraper.get_raise_value()
    # table_scraper.has_all_in_call_button()
    table_scraper.has_call_button()
    table_scraper.has_raise_button()
Exemple #7
0
 def test_all(self):
     """Test table button"""
     self.table_name = self.ui.table_name.currentText()
     from poker.scraper.recognize_table import TableScraper
     table_dict = mongo.get_table(table_name=self.table_name)
     table_scraper = TableScraper(table_dict)
     table_scraper.screenshot = self.original_screenshot
     table_scraper.crop_from_top_left_corner()
     table_scraper.is_my_turn()
     table_scraper.lost_everything()
     table_scraper.get_my_cards2()
     table_scraper.get_table_cards2()
     table_scraper.get_dealer_position2()
     table_scraper.get_players_in_game()
     table_scraper.get_pots()
     table_scraper.get_players_funds()
     table_scraper.get_call_value()
     table_scraper.get_raise_value()
     table_scraper.has_all_in_call_button()
     table_scraper.has_call_button()
     table_scraper.has_raise_button()
Exemple #8
0
def test_table_scraper():
    mongo = MongoManager()
    table_dict = mongo.get_table('default')
    table_scraper = TableScraper(table_dict)
    table_scraper.screenshot = Image.open(
        os.path.join(get_dir('tests', 'screenshots'), 'screenshot1.png'))
    table_scraper.crop_from_top_left_corner()
    table_scraper.is_my_turn()
    table_scraper.lost_everything()
    table_scraper.get_my_cards2()
    table_scraper.get_table_cards2()
    table_scraper.get_dealer_position2()
    table_scraper.get_players_in_game()
    table_scraper.get_pots()
    table_scraper.get_players_funds()
    table_scraper.get_call_value()
    table_scraper.get_raise_value()
    table_scraper.has_all_in_call_button()
    table_scraper.has_call_button()
    table_scraper.has_raise_button()
    table_scraper.get_game_number_on_screen2()