def test_ocr_valu10(): # ok log = logging.getLogger(__name__) mongo = MongoManager() table_dict = mongo.get_table('GG_6TABLE') 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(select_table=3) if is_debug: # table_scraper.screenshot.save('log/pics/table1.png') file_name = get_dir(os.path.join('log', 'pics', 'table_label.png')) save_table_rectangle_cv2(table_scraper.screenshot, table_dict, file_name) table_scraper.get_pots() table_scraper.get_players_funds() table_scraper.get_player_pots() log.info(f"{table_scraper.total_pot}") log.info(f"{table_scraper.player_funds}") log.info(f"{table_scraper.player_pots}") pytest.assume(table_scraper.total_pot == 5.0) # 73.0 pytest.assume(table_scraper.player_funds == [ 25.0, 11.0, 98.0, 188.5, 50.5, 100.0 ]) # [29.0, 6.0, 98.0, 108.9, 30.5, 10.0] pytest.assume(table_scraper.player_pots == [ -1.0, -1.0, 2.0, 2.0, 1.0, -1.0 ]) # [-1.0, -1.0, 25.0, -1.0, 1.0, -1.0]
def test_ocr_valu22(): # ok # init_logger(screenlevel=logging.DEBUG, filename='test-ocr', logdir='log') mongo = MongoManager() table_dict = mongo.get_table('GG_6TABLE') table_scraper = TableScraper(table_dict) table_scraper.screenshot = Image.open( os.path.join(os.environ['test_test'], '2.png')) table_scraper.crop_from_top_left_corner2(select_table=3) if is_debug: # table_scraper.screenshot.save('log/pics/table1.png') file_name = get_dir(os.path.join('log', 'pics', 'table_label.png')) save_table_rectangle_cv2(table_scraper.screenshot, table_dict, file_name) table_scraper.get_pots() table_scraper.get_players_funds() table_scraper.get_player_pots() log.info(f"{table_scraper.total_pot}") log.info(f"{table_scraper.player_funds}") log.info(f"{table_scraper.player_pots}") pytest.assume(table_scraper.total_pot == 12.5) pytest.assume( table_scraper.player_funds == [154.0, 104.5, 90.0, 95.0, 20.0, 190.0]) pytest.assume(table_scraper.player_pots == [ 2.0, 0.5, 10.0, -1.0, -1.0, -1.0 ]) # [2.0, 0.5, 10.0, -1.0, 4.0, -1.0]
def test_ocr_valu8(): # ok log = logging.getLogger(__name__) mongo = MongoManager() table_dict = mongo.get_table('GG_6TABLE') 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(select_table=0) if is_debug: # table_scraper.screenshot.save('log/pics/table1.png') file_name = get_dir(os.path.join('log', 'pics', 'table_label.png')) save_table_rectangle_cv2(table_scraper.screenshot, table_dict, file_name) table_scraper.get_pots() table_scraper.get_players_funds() table_scraper.get_player_pots() pytest.assume(table_scraper.total_pot == 12.5) pytest.assume( table_scraper.player_funds == [23.0, 100.0, 42.0, 23.0, 97.5, 102.0]) # pass pytest.assume( table_scraper.player_pots == [-1.0, -1.0, 6.0, -1.0, -1.0, -1.0]) # Ghost number
def test_ocr_valu6(): # ok log = logging.getLogger(__name__) mongo = MongoManager() table_dict = mongo.get_table('GG_6TABLE') table_scraper = TableScraper(table_dict) table_scraper.screenshot = Image.open( os.path.join(os.environ['test_src1'], '9.png')) table_scraper.crop_from_top_left_corner2(select_table=0) if is_debug: # table_scraper.screenshot.save('log/pics/table1.png') file_name = get_dir(os.path.join('log', 'pics', 'table_label.png')) save_table_rectangle_cv2(table_scraper.screenshot, table_dict, file_name) table_scraper.get_pots() table_scraper.get_players_funds() table_scraper.get_player_pots() log.info(f"{table_scraper.total_pot}") log.info(f"{table_scraper.player_funds}") log.info(f"{table_scraper.player_pots}") # assert table_scraper.total_pot == 4 pytest.assume(table_scraper.total_pot == 4.0) # 0.4 == 4.0 capture err pytest.assume( table_scraper.player_funds == [16.5, 23.5, 225.0, 65.5, 101.5, 100.0]) pytest.assume( table_scraper.player_pots == [-1.0, 0.5, 1.0, 2.5, -1.0, -1.0])
def test_4ocr_valu44(): # ok log = logging.getLogger(__name__) mongo = MongoManager() table_dict = mongo.get_table('GG_6TABLE') table_scraper = TableScraper(table_dict) file_name = get_dir(os.path.join('log', 'pics', 'table_b_16.png')) table_scraper.screenshot = Image.open(file_name) # table_scraper.crop_from_top_left_corner2(select_table=0) if is_debug: # table_scraper.screenshot.save('log/pics/table1.png') file_name = get_dir(os.path.join('log', 'pics', 'table_label.png')) save_table_rectangle_cv2(table_scraper.screenshot, table_dict, file_name) table_scraper.get_pots() table_scraper.get_players_funds() table_scraper.get_player_pots() log.info(f"{table_scraper.total_pot}") log.info(f"{table_scraper.current_round_pot}") log.info(f"{table_scraper.player_funds}") log.info(f"{table_scraper.player_pots}") # pytest.assume(table_scraper.total_pot == 4.0) # assert table_scraper.total_pot == 4.0 # pytest.assume(table_scraper.player_pots == [-1.0, -1.0, -1.0, 0.5, -1.0, 1.0]) pytest.assume(table_scraper.current_round_pot == 2.0)
def test_ocr_valu36(): # ok log = logging.getLogger(__name__) mongo = MongoManager() table_dict = mongo.get_table('GG_6TABLE') table_scraper = TableScraper(table_dict) table_scraper.screenshot = Image.open( os.path.join(os.environ['test_test'], '5.png')) table_scraper.crop_from_top_left_corner2(select_table=2) if is_debug: # table_scraper.screenshot.save('log/pics/table1.png') file_name = get_dir(os.path.join('log', 'pics', 'table_label.png')) save_table_rectangle_cv2(table_scraper.screenshot, table_dict, file_name) table_scraper.get_pots() table_scraper.get_players_funds() table_scraper.get_player_pots() log.info(f"{table_scraper.total_pot}") log.info(f"{table_scraper.player_funds}") log.info(f"{table_scraper.player_pots}") pytest.assume(table_scraper.total_pot == 12.0) pytest.assume( table_scraper.player_funds == [145.5, 100.0, 20.0, 18.0, 187.5, 94.5]) pytest.assume( table_scraper.player_pots == [-1.0, -1.0, -1.0, -1.0, -1.0, -1.0])
def test_card_download(): # 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(get_dir('tests', 'screenshots'), 'test5.png')) # screnshot = table_scraper.crop_from_top_left_corner() CARD_VALUES = "23456789TJQKA" CARD_SUITES = "CDHS" # CARD_VALUES = "9" # CARD_SUITES = "H" player = None minX = 100000 minY = 100000 for value in CARD_VALUES: for suit in CARD_SUITES: template_cv2 = table_dict[value.lower() + suit.lower() ] template_cv2 = binary_pil_to_cv2(template_cv2) template_cv2 = template_cv2[:50, :25, :] plt.imshow(template_cv2, cmap='gray', interpolation='bicubic') plt.show() # if player: # search_area = table_dict[image_area][player] # else: # search_area = table_dict[image_area] log.info(f'{template_cv2.shape}') if template_cv2.shape[0] <= minX: minX = template_cv2.shape[0] if template_cv2.shape[1] <= minY: minY = template_cv2.shape[1] # plt.imshow(template_cv2, cmap='gray', interpolation='bicubic') # plt.show() log.info(f'minX:{minX},minY:{minY}')
def test_ocr_ps1(): mongo = MongoManager() table_dict = mongo.get_table("Official Poker Stars") table_scraper = TableScraper(table_dict) table_scraper.screenshot = Image.open( os.path.join(get_dir('tests', 'screenshots'), 'ps473830744_Flop_1.png')) table_scraper.crop_from_top_left_corner() result = ocr(table_scraper.screenshot, 'total_pot_area', table_scraper.table_dict) assert result == 0.29 result = ocr(table_scraper.screenshot, 'call_value', table_scraper.table_dict) assert result == 0.04 result = ocr(table_scraper.screenshot, 'raise_value', table_scraper.table_dict) assert result == 0.08 result = ocr(table_scraper.screenshot, 'player_funds_area', table_scraper.table_dict, player='0') assert result == 1.67
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, '', '']
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, '', '']
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, '', '']
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 save_image(self, label): if not self.preview: pop_up( "Mark an image first.", "Before you can save an image, you need to take a screenshot (with the take screenshot button)," "Then you need to mark the top left corner of the poker window (or load a previously saved one)" "After that an image needs to be marked by clicking on the top left and then bottom right corner of that image." ) return log.info(f"flattening button {label}") self.signal_flatten_button.emit(label) self.table_name = self.ui.table_name.currentText() mongo = MongoManager() owner = mongo.get_table_owner(self.table_name) if owner != COMPUTER_NAME: pop_up( "Not authorized.", "You can only edit your own tables. Please create a new copy or start with a new blank table" ) return log.info(f"Saving {label}") mongo.update_table_image(pil_image=self.preview, label=label, table_name=self.table_name) log.info("Saving complete")
def __init__(self, ui): """Initial""" super().__init__() self.ui = ui self.connect_signals_with_slots() self.screenshot_clicks = 0 self.preview = None self.table_name = None self.original_screenshot = None self.screenshot_image = None self.x1 = None self.x2 = None self.y1 = None self.y2 = None self.top_left_corner_img = None self.tlc = None self.selected_player = '0' self.cropped = False self.select_table = 0 self.tableList = [] mongo = MongoManager() available_tables = mongo.get_available_tables() self.ui.table_name.addItems(available_tables)
def get_table_delta(): p = StrategyHandler() p.read_strategy() p.read_strategy() mongo = MongoManager() table_dict = mongo.get_table('GG_6TABLE') gui_signals = MagicMock() gui_signals.select_table = 0 # select table game_logger = GameLogger() version = 4.21 t = TableScreenBased(p, table_dict, gui_signals, game_logger, version) ready = False while (not ready): ready = t.take_screenshot(True, p) and \ t.get_top_left_corner(p, gui_signals) and \ t.get_gg_poker() log.debug(f"Top left corner: {t.tlc}") log.debug(f"GG Poker : {t.gg_poker}") delta_x = 308 + (t.tlc[0] - t.gg_poker[0]) delta_y = 287 + (t.tlc[1] - t.gg_poker[1]) log.debug(f"delta_x, delta_y : {delta_x}, {delta_y} ") return delta_x, delta_y
def test_ocr_pp1(): mongo = MongoManager() table_dict = mongo.get_table("Official Party Poker") table_scraper = TableScraper(table_dict) table_scraper.screenshot = Image.open( os.path.join(get_dir('tests', 'screenshots'), '53269218_PreFlop_0.png')) table_scraper.crop_from_top_left_corner() result = ocr(table_scraper.screenshot, 'total_pot_area', table_scraper.table_dict) assert result == 0.08 result = ocr(table_scraper.screenshot, 'call_value', table_scraper.table_dict) assert result == 0.03 result = ocr(table_scraper.screenshot, 'raise_value', table_scraper.table_dict) assert result == 0.08 result = ocr(table_scraper.screenshot, 'player_funds_area', table_scraper.table_dict, player='0') assert result == 1.98
def test_find_backup_image(): p = StrategyHandler() p.read_strategy() p.read_strategy() mongo = MongoManager() table_dict = mongo.get_table('GG_6TABLE') gui_signals = MagicMock() gui_signals.select_table = 0 # select table game_logger = GameLogger() version = 4.21 t = TableScreenBased(p, table_dict, gui_signals, game_logger, version) image_backup = 10 t.current_round_pot = 1 while t.current_round_pot > 0: try: file_name = get_dir(os.path.join("log", "pics", 'table_' + str(image_backup) + '.png')) t.screenshot = Image.open(file_name) t.get_pots() if t.current_round_pot < 0: log.info(f"current_round_pot :{t.current_round_pot}.") break # log.info(f"Use backup image {image_backup}.") except: pass image_backup -= 1 log.info(f"Use backup image {image_backup}.") return image_backup
def test_table_video(): # Prepare table tlc = [1557, 289] someone_stop = False # Init table function p = StrategyHandler() p.read_strategy() mongo = MongoManager() table_dict = mongo.get_table('GG_6TABLE') gui_signals = MagicMock() gui_signals.select_table = 0 # select table game_logger = MagicMock() version = 4.21 t = TableScreenBased(p, table_dict, gui_signals, game_logger, version) t.screenshot = get_screenshot('cropped', tlc) preflop_state_Zenith = CurrentHandPreflopStateZenith() if someone_stop: sys.exit() ready = False image_backup = 10 t.get_players_in_game() exclude = set(range(6)) - set(t.players_in_game) t.get_player_pots(skip=list(exclude)) log.info(f"{t.players_in_game}") log.info(f"{t.player_pots}")
def test_ocr_pp1(): 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() result = ocr(table_scraper.screenshot, 'total_pot_area', table_scraper.table_dict) assert result == 0.09 result = ocr(table_scraper.screenshot, 'call_value', table_scraper.table_dict) assert result == 0.04 result = ocr(table_scraper.screenshot, 'raise_value', table_scraper.table_dict) assert result == 0.1 result = ocr(table_scraper.screenshot, 'player_funds_area', table_scraper.table_dict, player='0') assert result == 1.32
def get_table_template_image(table_name='default', label='topleft_corner'): """Load template from mongodb as cv2 image""" mongo = MongoManager() table = mongo.get_table(table_name=table_name) template_pil = Image.open(io.BytesIO(table[label])) template_cv2 = cv2.cvtColor(np.array(template_pil), cv2.COLOR_BGR2RGB) return template_cv2
def test_is_my_turn(): ## ok!!! log = logging.getLogger(__name__) mongo = MongoManager() table_dict = mongo.get_table('GG_6TABLE') test_src = os.environ['test_src'] table_scraper = TableScraper(table_dict) table_scraper.screenshot = Image.open(os.path.join(test_src, '1.PNG')) table_scraper.crop_from_top_left_corner2(select_table=0) screenshot = table_scraper.crop_from_top_left_corner() status = is_template_in_search_area(table_dict, screenshot, 'my_turn', 'my_turn_search_area', table_scraper.scale_defaults) log.debug(is_template_in_search_area(table_dict, screenshot, 'my_turn', 'my_turn_search_area', table_scraper.scale_defaults)) # search_area = table_dict['my_turn_search_area'] template = table_dict['my_turn'] template_cv2 = binary_pil_to_cv2(template) cropped_screenshot = screenshot.crop((search_area['x1'], search_area['y1'], search_area['x2'], search_area['y2'])) screenshot_cv2 = pil_to_cv2(cropped_screenshot) # plt.imshow(cropped_screenshot, cmap='gray', interpolation='bicubic') # ok! # plt.imshow(template_cv2, cmap='gray', interpolation='bicubic') # plt.show() assert status == True
def test_table_preflop_zenith(): # tlc = get_table_tlc() # Init table function p = StrategyHandler() p.read_strategy() mongo = MongoManager() table_dict = mongo.get_table('GG_6TABLE') gui_signals = MagicMock() gui_signals.select_table = 0 # select table game_logger = MagicMock() version = 4.21 SB = 0.5 prefix = 'e' t = TableScreenBased(p, table_dict, gui_signals, game_logger, version) t.screenshot = Image.open( get_dir(os.path.join('log', 'pics', 'table_' + prefix + '_0.png'))) t.get_dealer_position() t.get_miss_player() p_Zenith = CurrentHandPreflopStateZenith() p_Zenith.reset() # Specify miss player or calculate through t.get_miss_player(). p_Zenith.miss_player = t.miss_player p_Zenith.dealer_position = t.dealer_position p_Zenith.small_blind = SB p_Zenith.abs_to_rel() table_preflop_zenith(t, p_Zenith, prefix, -2, 20) print(p_Zenith.actions)
def test_write_table(): # ok!!! log = logging.getLogger(__name__) mongo = MongoManager() table_dict = mongo.get_table('GG_TEST') # print(table_dict) filename = str(os.getpid()) + '.txt' fo = open(filename, "w") fo.write(str(table_dict)) fo.close()
def blank_new(self): mongo = MongoManager() ok = mongo.create_new_table(self.ui.new_name.text()) if ok: self.ui.table_name.addItems([self.ui.new_name.text()]) self.ui.table_name.setCurrentIndex(self.ui.table_name.count() - 1) else: pop_up("Unable to create new table with that name", "Please choose a different name.")
def test_6table_and_my_cards6(): # ok log = logging.getLogger(__name__) mongo = MongoManager() table_dict = mongo.get_table('GG_6TABLE') table_scraper = TableScraper(table_dict) table_scraper.screenshot = Image.open(os.path.join(os.environ['test_src1'], '5.png')) table_scraper.crop_from_top_left_corner2(select_table=0) table_scraper.get_my_cards3() assert set(table_scraper.my_cards) == set(['7D', '7H']) # ok
def test_table_and_my_cards39(): # ok log = logging.getLogger(__name__) mongo = MongoManager() table_dict = mongo.get_table('GG_6TABLE') table_scraper = TableScraper(table_dict) table_scraper.screenshot = Image.open(os.path.join(os.environ['test_src'], '10.png')) table_scraper.crop_from_top_left_corner2(select_table=3) table_scraper.get_my_cards3() print(table_scraper.table_cards) assert set(table_scraper.my_cards) == {'AH', 'KC'} # Passed
def test_table_and_my_cards50(): # 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'], '15.png')) table_scraper.crop_from_top_left_corner2(select_table=2) table_scraper.get_table_cards2() print(table_scraper.table_cards) assert set(table_scraper.table_cards) == {'AS', '2S', '6S', '8C', '7H'} # Miss AS, 6S
def test_table_and_my_cards30(): # 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_test'], '5.png')) table_scraper.crop_from_top_left_corner2(select_table=4) table_scraper.get_table_cards2() print(table_scraper.table_cards) assert set(table_scraper.table_cards) == {'3C', '5C', '7S', '2D'} # Miss 3C, 5C => FIXED BY UPDATE SIZE
def test_table_and_my_cards27(): # 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_test'], '4.png')) table_scraper.crop_from_top_left_corner2(select_table=4) table_scraper.get_table_cards2() print(table_scraper.table_cards) assert set(table_scraper.table_cards) == {'4C', '6C', '2H'} # Miss 4C => Passed by resize => Miss 4C, 6C
def test_table_and_my_cards15(): # 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_test'], '1.png')) table_scraper.crop_from_top_left_corner2(select_table=3) table_scraper.get_table_cards2() print(table_scraper.table_cards) assert set(table_scraper.table_cards) == {'5C', 'QS', 'JH', '8D'} # ok