コード例 #1
0
 async def get_local_size(
         self, game_id, context: Dict[str,
                                      pathlib.PurePath]) -> Optional[int]:
     try:
         return parse_map_crc_for_total_size(context[game_id])
     except (KeyError, FileNotFoundError) as e:
         raise UnknownError(
             f"Manifest for game {game_id} is not found: {repr(e)} | context: {context}"
         )
コード例 #2
0
def test_parse_map_crc_for_total_size_no_file():
    with pytest.raises(FileNotFoundError):
        parse_map_crc_for_total_size('nonexisting/path')
コード例 #3
0
def test_parse_map_crc_for_total_size(content, expected, tmp_path):
    crc_file = tmp_path / 'map.crc'
    crc_file.write_text(content, encoding='utf-16-le')
    assert expected == parse_map_crc_for_total_size(crc_file)