def iconfile_md5( self, asset: Asset, ) -> Optional[str]: # First try with the custom icon path custom_icon_path = self.custom_iconfile_path(asset) if custom_icon_path is not None: return file_md5(custom_icon_path) path = self.iconfile_path(asset) if not path.is_file(): return None return file_md5(path)
def iconfile_md5( self, asset: Asset, size: Literal['thumb', 'small', 'large'], ) -> Optional[str]: # First try with the custom icon path custom_icon_path = self.custom_iconfile_path(asset) if custom_icon_path is not None: return file_md5(custom_icon_path) path = self.iconfile_path(asset, size) if not path.is_file(): return None return file_md5(path)
def iconfile_md5( self, asset: Asset, size: Literal['thumb', 'small', 'large'], ) -> Optional[str]: path = self.iconfile_path(asset, size) if not path.is_file(): return None return file_md5(path)
def test_assets_json_meta(): """Test that all_assets.json md5 matches and that if md5 changes since last time then version is also bumped""" last_meta = {'md5': '29a8dd8b73db28b2736c8ee8231d9e22', 'version': 70} data_dir = Path(__file__).resolve().parent.parent.parent / 'data' data_md5 = file_md5(data_dir / 'all_assets.json') with open(data_dir / 'all_assets.meta', 'r') as f: saved_meta = json.loads(f.read()) assert data_md5 == saved_meta['md5'] msg = 'The last meta md5 of the test does not match the one in all_assets.meta' assert saved_meta['md5'] == last_meta['md5'], msg msg = 'The last meta version of the test does not match the one in all_assets.meta' assert saved_meta['version'] == last_meta['version'], msg
def test_assets_json_meta(): """Test that all_assets.json md5 matches and that if md5 changes since last time then version is also bumped""" last_meta = {'md5': '51bddc1b4e8bd6d30027c4380cdf9d4f', 'version': 72} data_dir = Path(__file__).resolve().parent.parent.parent / 'data' data_md5 = file_md5(data_dir / 'all_assets.json') with open(data_dir / 'all_assets.meta', 'r') as f: saved_meta = json.loads(f.read()) assert data_md5 == saved_meta['md5'] msg = 'The last meta md5 of the test does not match the one in all_assets.meta' assert saved_meta['md5'] == last_meta['md5'], msg msg = 'The last meta version of the test does not match the one in all_assets.meta' assert saved_meta['version'] == last_meta['version'], msg
def test_assets_json_meta(): """Test that all_assets.json md5 matches and that if md5 changes since last time then version is also bumped""" last_meta = {'md5': 'f23860c6876948c299b95389445b5101', 'version': 64} data_dir = Path(__file__).resolve().parent.parent.parent / 'data' data_md5 = file_md5(data_dir / 'all_assets.json') with open(data_dir / 'all_assets.meta', 'r') as f: saved_meta = json.loads(f.read()) assert data_md5 == saved_meta['md5'] msg = 'The last meta md5 of the test does not match the one in all_assets.meta' assert saved_meta['md5'] == last_meta['md5'], msg msg = 'The last meta version of the test does not match the one in all_assets.meta' assert saved_meta['version'] == last_meta['version'], msg
def test_assets_json_meta(): """Test that all_assets.json md5 matches and that if md5 changes since last time then version is also bumped""" last_meta = {'md5': 'c909de1fdce5f1804ae212dda1f20ac4', 'version': 30} data_dir = Path(__file__).resolve().parent.parent.parent / 'data' data_md5 = file_md5(data_dir / 'all_assets.json') with open(data_dir / 'all_assets.meta', 'r') as f: saved_meta = json.loads(f.read()) assert data_md5 == saved_meta['md5'] if data_md5 != last_meta['md5']: msg = ( 'The md5 has changed since the last time assets.json was edited ' 'and the version has not been bumped', ) assert saved_meta['version'] == last_meta['version'] + 1, msg
def test_uniswapv2_lp_tokens_json_meta(): """Test that uniswapv2_lp_tokens.json md5 matches and that if md5 changes since last time then version is also bumped""" last_meta = {'md5': '5520c3b05773f6aba3d9495ea2a90706', 'version': 1} data_dir = Path(__file__).resolve().parent.parent.parent.parent / 'data' data_md5 = file_md5(data_dir / 'uniswapv2_lp_tokens.json') with open(data_dir / 'uniswapv2_lp_tokens.meta', 'r') as f: saved_meta = json.loads(f.read()) assert data_md5 == saved_meta['md5'] if data_md5 != last_meta['md5']: msg = ( 'The md5 has changed since the last time uniswapv2_lp_tokens.json' ' was edited and the version has not been bumped', ) assert saved_meta['version'] == last_meta['version'] + 1, msg