From 8dec1c4712d97d46ab4042e796bccfb881374699 Mon Sep 17 00:00:00 2001 From: m77so Date: Wed, 3 Aug 2022 00:58:20 +0900 Subject: [PATCH] fix super linter format --- library/hatomap.py | 238 +++++++++++++++++++++++-------------- library/jma_amesh.py | 101 +++++++++------- tests/plugins/test_hato.py | 56 +++++---- 3 files changed, 240 insertions(+), 155 deletions(-) diff --git a/library/hatomap.py b/library/hatomap.py index a63989cf20..68e32ca63d 100644 --- a/library/hatomap.py +++ b/library/hatomap.py @@ -5,7 +5,6 @@ import string from dataclasses import dataclass, field from multiprocessing import Pool - from typing import Any, List, Optional, Tuple, Union import cv2 @@ -50,9 +49,14 @@ class WebMercatorPixelCoord: def from_geocoord(cls, geocoord: GeoCoord, zoom: int) -> WebMercatorPixelCoord: return cls( 256 * (1 << zoom) * (geocoord.lng + 180) / 360, - 256 * (1 << zoom) * (.5 - math.log(math.tan(math.pi / - 4 + geocoord.lat * math.pi / 180 / 2)) / (2 * math.pi)), - zoom + 256 + * (1 << zoom) + * ( + 0.5 + - math.log(math.tan(math.pi / 4 + geocoord.lat * math.pi / 180 / 2)) + / (2 * math.pi) + ), + zoom, ) def to_geocoord(self) -> GeoCoord: @@ -66,10 +70,10 @@ def belongs_tile(self) -> WebMercatorTilePixel: WebMercatorTile( tile_x=int(self.pixel_x // 256), tile_y=int(self.pixel_y // 256), - zoom_level=self.zoom_level + zoom_level=self.zoom_level, ), int(round(self.pixel_x % 256)), - int(round(self.pixel_y % 256)) + int(round(self.pixel_y % 256)), ) @@ -94,28 +98,44 @@ def covered_tiles(self) -> Tuple[WebMercatorTilePixel, WebMercatorTilePixel]: ).belongs_tile(), WebMercatorPixelCoord( self.pixel_x_east, self.pixel_y_south, self.zoom - ).belongs_tile() + ).belongs_tile(), ) def geocoord2pixel(self, geocoord: GeoCoord) -> Tuple[int, int]: wmp_coord = WebMercatorPixelCoord.from_geocoord(geocoord, self.zoom) return ( int(round(wmp_coord.pixel_x - self.pixel_x_west)), - int(round(wmp_coord.pixel_y - self.pixel_y_north)) + int(round(wmp_coord.pixel_y - self.pixel_y_north)), ) def _ndarray_geocoords2pixel(self, geocoords: np.ndarray) -> np.ndarray: - return np.array([ - 256 * (1 << self.zoom) * - (geocoords[..., 1] + 180) / 360 - self.pixel_x_west, - 256 * (1 << self.zoom) * - (.5 - np.log(np.tan(np.pi / 4 + - geocoords[..., 0] * np.pi / 180 / 2)) / (2 * np.pi)) - - self.pixel_y_north - ]).astype(np.int32).T + return ( + np.array( + [ + 256 * (1 << self.zoom) * (geocoords[..., 1] + 180) / 360 + - self.pixel_x_west, + 256 + * (1 << self.zoom) + * ( + 0.5 + - np.log( + np.tan(np.pi / 4 + geocoords[..., 0] * np.pi / 180 / 2) + ) + / (2 * np.pi) + ) + - self.pixel_y_north, + ] + ) + .astype(np.int32) + .T + ) def geocoords2pixel( - self, geocoords: Union[np.ndarray, List[np.ndarray], List[GeoCoord], List[List[GeoCoord]]]) -> Any: + self, + geocoords: Union[ + np.ndarray, List[np.ndarray], List[GeoCoord], List[List[GeoCoord]] + ], + ) -> Any: if type(geocoords) is np.ndarray: return self._ndarray_geocoords2pixel(geocoords) @@ -138,8 +158,7 @@ class MapBox: height: int = 800 def pixelbbox(self) -> WebMercatorPixelBBox: - center_pixel = WebMercatorPixelCoord.from_geocoord( - self.center, self.zoom) + center_pixel = WebMercatorPixelCoord.from_geocoord(self.center, self.zoom) origin_pixel_x = int(round(center_pixel.pixel_x - self.width / 2)) origin_pixel_y = int(round(center_pixel.pixel_y - self.height / 2)) return WebMercatorPixelBBox( @@ -147,7 +166,7 @@ def pixelbbox(self) -> WebMercatorPixelBBox: pixel_x_east=origin_pixel_x + self.width, pixel_y_north=origin_pixel_y, pixel_y_south=origin_pixel_y + self.height, - zoom=self.zoom + zoom=self.zoom, ) @@ -158,8 +177,7 @@ class RasterTileServer: @staticmethod def _get_image_content(url): return cv2.imdecode( - np.asarray(bytearray(requests.get(url).content), dtype=np.uint8), - -1 + np.asarray(bytearray(requests.get(url).content), dtype=np.uint8), -1 ) def request(self, bbox: WebMercatorPixelBBox = None) -> np.ndarray: @@ -172,9 +190,9 @@ def request(self, bbox: WebMercatorPixelBBox = None) -> np.ndarray: for x in range(tl_tilepx.tile.tile_x, rb_tilepx.tile.tile_x + 1): for y in range(tl_tilepx.tile.tile_y, rb_tilepx.tile.tile_y + 1): request_urls.append( - string.Template(self.url).safe_substitute({ - "x": x, "y": y, "z": bbox.zoom - }) + string.Template(self.url).safe_substitute( + {"x": x, "y": y, "z": bbox.zoom} + ) ) with Pool(16) as p: imgs = list(p.imap(self._get_image_content, request_urls)) @@ -186,7 +204,7 @@ def request(self, bbox: WebMercatorPixelBBox = None) -> np.ndarray: [ np.concatenate(imgs[i:i + tile_height_cnt], axis=0) for i in range(0, len(imgs), tile_height_cnt) ], - axis=1 + axis=1, ) px_top = tl_tilepx.tile_pixel_y @@ -206,17 +224,23 @@ class LineTrace: def get_image(self, bbox: WebMercatorPixelBBox = None) -> np.ndarray: img = np.zeros((bbox.height, bbox.width, 4), np.uint8) if type(self.coords[0][0]) is GeoCoord: - coords = [np.array([[g.lat, g.lng] for g in coords]) - for coords in self.coords] + coords = [ + np.array([[g.lat, g.lng] for g in coords]) for coords in self.coords + ] elif type(self.coords[0][0][0]) is np.float64: coords = self.coords else: - raise TypeError( - "coords should be List[np.ndarray] or List[List[GeoCoord]]") + raise TypeError("coords should be List[np.ndarray] or List[List[GeoCoord]]") px_coords = bbox.geocoords2pixel(coords) - cv2.polylines(img, px_coords, color=self.color, - thickness=self.width, isClosed=True, lineType=cv2.LINE_AA) + cv2.polylines( + img, + px_coords, + color=self.color, + thickness=self.width, + isClosed=True, + lineType=cv2.LINE_AA, + ) return img @@ -239,45 +263,75 @@ def get_image(self, bbox: WebMercatorPixelBBox = None) -> np.ndarray: elif type(self.coords[0][0]) is np.float64: coords = self.coords else: - raise TypeError( - "coords should be List[np.ndarray] or List[List[GeoCoord]]") + raise TypeError("coords should be List[np.ndarray] or List[List[GeoCoord]]") px_coords = bbox.geocoords2pixel(coords) symbols = { - "thunder": np.array([ - [1, -3], [-0, -0.5], [2, -0.5], [-1, 3], [0, 0.5], [-2, 0.5] - ]) / 6 + "thunder": np.array( + [[1, -3], [-0, -0.5], [2, -0.5], [-1, 3], [0, 0.5], [-2, 0.5]] + ) + / 6 } if self.symbol == "circle": for c in px_coords: print(c) if self.fill_color is not None: - cv2.circle(img, c, int(round(self.size / 2)), thickness=- - 1, color=self.fill_color, lineType=cv2.LINE_AA) - cv2.circle(img, c, int(round(self.size / 2)), thickness=self.border_width, - color=self.border_color, lineType=cv2.LINE_AA) + cv2.circle( + img, + c, + int(round(self.size / 2)), + thickness=-1, + color=self.fill_color, + lineType=cv2.LINE_AA, + ) + cv2.circle( + img, + c, + int(round(self.size / 2)), + thickness=self.border_width, + color=self.border_color, + lineType=cv2.LINE_AA, + ) elif self.symbol == "square": for c in px_coords: tl = (c - self.size / 2).astype(np.int32) br = (c + self.size / 2).astype(np.int32) if self.fill_color is not None: - cv2.rectangle(img, tl, br, thickness=-1, - color=self.fill_color, lineType=cv2.LINE_AA) - cv2.rectangle(img, tl, br, thickness=self.border_width, - color=self.border_color, lineType=cv2.LINE_AA) + cv2.rectangle( + img, + tl, + br, + thickness=-1, + color=self.fill_color, + lineType=cv2.LINE_AA, + ) + cv2.rectangle( + img, + tl, + br, + thickness=self.border_width, + color=self.border_color, + lineType=cv2.LINE_AA, + ) elif self.symbol in symbols.keys(): symbol_coords = symbols[self.symbol] - px_coords = np.repeat( - px_coords[:, np.newaxis, :], symbol_coords.shape[0], axis=1 - ) + symbol_coords * self.size + px_coords = ( + np.repeat(px_coords[:, np.newaxis, :], symbol_coords.shape[0], axis=1) + + symbol_coords * self.size + ) px_coords = px_coords.astype(np.int32) for c in px_coords: if self.fill_color is not None: - cv2.fillPoly( - img, [c], color=self.fill_color, lineType=cv2.LINE_AA) - cv2.polylines(img, [c], color=self.border_color, - thickness=self.border_width, isClosed=True, lineType=cv2.LINE_AA) + cv2.fillPoly(img, [c], color=self.fill_color, lineType=cv2.LINE_AA) + cv2.polylines( + img, + [c], + color=self.border_color, + thickness=self.border_width, + isClosed=True, + lineType=cv2.LINE_AA, + ) return img @@ -291,7 +345,7 @@ class RasterLayer: def __post_init__(self): if not (0 <= self.opacity <= 1.0): - raise ValueError('Opacity is out of range.') + raise ValueError("Opacity is out of range.") def get_image(self, bbox: WebMercatorPixelBBox = None) -> np.ndarray: if type(self.url) is list: @@ -307,8 +361,7 @@ def get_image(self, bbox: WebMercatorPixelBBox = None) -> np.ndarray: layer_img = cv2.cvtColor(img_hsv, cv2.COLOR_HSV2BGR) if self.opacity != 1.0: - layer_img[layer_img[..., 3] != 0, 3] = int( - round(self.opacity * 256)) + layer_img[layer_img[..., 3] != 0, 3] = int(round(self.opacity * 256)) return layer_img @@ -336,16 +389,15 @@ class HatoMap: layers: 地図の上から地図タイルや線・点などを描画する title: タイトル """ + mapbox: MapBox = MapBox() - basemap: str = 'open-street-map' + basemap: str = "open-street-map" extra_basemap_server: str = None layers: List[Union[RasterLayer, LineTrace]] = None title: str = None def update_layout( - self, - mapbox: MapBox = None, - layers: List[Union[RasterLayer, LineTrace]] = None + self, mapbox: MapBox = None, layers: List[Union[RasterLayer, LineTrace]] = None ) -> None: if mapbox is not None: self.mapbox = mapbox @@ -355,35 +407,41 @@ def update_layout( @property def basemap_layer(self): basemaps = { - 'open-street-map': RasterLayer([ - 'https://a.tile.openstreetmap.org/${z}/${x}/${y}.png', - 'https://b.tile.openstreetmap.org/${z}/${x}/${y}.png', - 'https://c.tile.openstreetmap.org/${z}/${x}/${y}.png' - ]), - 'open-street-map-dim': RasterLayer([ - 'https://a.tile.openstreetmap.org/${z}/${x}/${y}.png', - 'https://b.tile.openstreetmap.org/${z}/${x}/${y}.png', - 'https://c.tile.openstreetmap.org/${z}/${x}/${y}.png' - ], - brightness=0.8, chroma=0.6 + "open-street-map": RasterLayer( + [ + "https://a.tile.openstreetmap.org/${z}/${x}/${y}.png", + "https://b.tile.openstreetmap.org/${z}/${x}/${y}.png", + "https://c.tile.openstreetmap.org/${z}/${x}/${y}.png", + ] ), - 'carto-light': RasterLayer([ - 'https://cartodb-basemaps-a.global.ssl.fastly.net/light_all/${z}/${x}/${y}.png', - 'https://cartodb-basemaps-c.global.ssl.fastly.net/light_all/${z}/${x}/${y}.png', - ]), - 'carto-dark': RasterLayer([ - 'https://cartodb-basemaps-b.global.ssl.fastly.net/dark_all/${z}/${x}/${y}.png', - 'https://cartodb-basemaps-d.global.ssl.fastly.net/dark_all/${z}/${x}/${y}.png', - ]), - 'extra': RasterLayer([ - self.extra_basemap_server - ]) + "open-street-map-dim": RasterLayer( + [ + "https://a.tile.openstreetmap.org/${z}/${x}/${y}.png", + "https://b.tile.openstreetmap.org/${z}/${x}/${y}.png", + "https://c.tile.openstreetmap.org/${z}/${x}/${y}.png", + ], + brightness=0.8, + chroma=0.6, + ), + "carto-light": RasterLayer( + [ + "https://cartodb-basemaps-a.global.ssl.fastly.net/light_all/${z}/${x}/${y}.png", + "https://cartodb-basemaps-c.global.ssl.fastly.net/light_all/${z}/${x}/${y}.png", + ] + ), + "carto-dark": RasterLayer( + [ + "https://cartodb-basemaps-b.global.ssl.fastly.net/dark_all/${z}/${x}/${y}.png", + "https://cartodb-basemaps-d.global.ssl.fastly.net/dark_all/${z}/${x}/${y}.png", + ] + ), + "extra": RasterLayer([self.extra_basemap_server]), } if self.basemap in basemaps.keys(): return basemaps[self.basemap] - return basemaps['open-street-map'] + return basemaps["open-street-map"] def get_image(self, height: int = None, width: int = None) -> np.ndarray: offset_top = 0 @@ -401,14 +459,20 @@ def get_image(self, height: int = None, width: int = None) -> np.ndarray: if body_img is None: body_img = layer_img[..., :3] else: - body_img = body_img[..., :3] * (1 - layer_img[..., 3:] / 255) + \ - layer_img[..., :3] * (layer_img[..., 3:] / 255) + body_img = body_img[..., :3] * ( + 1 - layer_img[..., 3:] / 255 + ) + layer_img[..., :3] * (layer_img[..., 3:] / 255) img = np.zeros((height, width, 3), np.uint8) img.fill(255) img[offset_top:, :] = body_img - img = cv2_putText_3(img, self.title, (0, offset_top), "./library/assets/ipag.ttf", - fontScale=16, - color=(0, 0, 0)) + img = cv2_putText_3( + img, + self.title, + (0, offset_top), + "./library/assets/ipag.ttf", + fontScale=16, + color=(0, 0, 0), + ) return img diff --git a/library/jma_amesh.py b/library/jma_amesh.py index 510556e531..fc93c17489 100644 --- a/library/jma_amesh.py +++ b/library/jma_amesh.py @@ -3,8 +3,6 @@ """ jma_amesh """ -from PIL import Image, ImageEnhance -from slackbot_settings import VERSION from PIL import Image from library.hatomap import ( GeoCoord, @@ -12,7 +10,7 @@ LineTrace, MapBox, MarkerTrace, - RasterLayer + RasterLayer, ) import datetime import json @@ -36,9 +34,9 @@ class TimeJsonElement: def get_latest_timestamps() -> dict: """データごとの最終更新時刻を取得する""" urls = [ - 'https://www.jma.go.jp/bosai/jmatile/data/nowc/targetTimes_N1.json', - 'https://www.jma.go.jp/bosai/jmatile/data/nowc/targetTimes_N2.json', - 'https://www.jma.go.jp/bosai/jmatile/data/nowc/targetTimes_N3.json' + "https://www.jma.go.jp/bosai/jmatile/data/nowc/targetTimes_N1.json", + "https://www.jma.go.jp/bosai/jmatile/data/nowc/targetTimes_N2.json", + "https://www.jma.go.jp/bosai/jmatile/data/nowc/targetTimes_N3.json", ] timejson = [] for url in urls: @@ -48,41 +46,50 @@ def get_latest_timestamps() -> dict: timejson += data elements = list(set([e for i in timejson for e in i.elements])) - return dict([ - (e, - max( - [i.basetime for i in timejson if i.basetime == - i.validtime and e in i.elements] + return dict( + [ + ( + e, + max( + [ + i.basetime + for i in timejson + if i.basetime == i.validtime and e in i.elements + ] + ), ) - ) - for e in elements - ]) + for e in elements + ] + ) def timestamp2jst(timestamp: str) -> str: """targetTimes.jsonの時刻書式をJSTに変換し読みやすくする""" - return datetime.datetime.strptime(timestamp, '%Y%m%d%H%M%S') \ - .replace(tzinfo=datetime.timezone.utc) \ - .astimezone(datetime.timezone(datetime.timedelta(hours=9))) \ + return ( + datetime.datetime.strptime(timestamp, "%Y%m%d%H%M%S") + .replace(tzinfo=datetime.timezone.utc) + .astimezone(datetime.timezone(datetime.timedelta(hours=9))) .strftime("%Y-%m-%d %H:%M") - + ) def get_jma_image_server(timestamp: str) -> str: """気象庁雨雲レーダー画像を取得する""" - return f'https://www.jma.go.jp/bosai/jmatile/data/nowc/{timestamp}/none/{timestamp}/surf/hrpns/${{z}}/${{x}}/${{y}}.png' # noqa: E501 + return f"https://www.jma.go.jp/bosai/jmatile/data/nowc/{timestamp}/none/{timestamp}/surf/hrpns/${{z}}/${{x}}/${{y}}.png" # noqa: E501 def get_liden(timestamp: str) -> Optional[List[Tuple[float, float, int]]]: """気象庁落雷JSONを取得する""" - liden_json_url = f'https://www.jma.go.jp/bosai/jmatile/data/nowc/{timestamp}/none/{timestamp}/surf/liden/data.geojson' # noqa: E501 + liden_json_url = f"https://www.jma.go.jp/bosai/jmatile/data/nowc/{timestamp}/none/{timestamp}/surf/liden/data.geojson" # noqa: E501 response = requests.get(liden_json_url) if response.status_code == 200: return [ - (e["geometry"]["coordinates"][1], - e["geometry"]["coordinates"][0], - e["properties"]["type"] - ) for e in json.loads(response.text)["features"] + ( + e["geometry"]["coordinates"][1], + e["geometry"]["coordinates"][0], + e["properties"]["type"], + ) + for e in json.loads(response.text)["features"] ] return None @@ -91,17 +98,14 @@ def get_circle(lat: float, lng: float, radius: float) -> np.ndarray: """指定した地点から半径radiusメートルの正360角形の頂点を列挙する""" earth_radius = 6378137 earth_f = 298.257222101 - earth_e_sq = (2 * earth_f - 1) / earth_f ** 2 + earth_e_sq = (2 * earth_f - 1) / earth_f**2 c = 1 - (earth_e_sq * math.sin(lat) ** 2) - meter_1deg_lat = math.pi * earth_radius * \ - (1 - earth_e_sq) / (180 * c ** 1.5) - meter_1deg_lng = math.pi * earth_radius * \ - math.cos(lat * math.pi / 180) / (180 * math.sqrt(c)) - - lats = np.sin(np.radians(np.arange(0, 361, 1))) * \ - radius / meter_1deg_lat + lat - lngs = np.cos(np.radians(np.arange(0, 361, 1))) * \ - radius / meter_1deg_lng + lng + meter_1deg_lat = math.pi * earth_radius * (1 - earth_e_sq) / (180 * c**1.5) + meter_1deg_lng = ( + math.pi * earth_radius * math.cos(lat * math.pi / 180) / (180 * math.sqrt(c)) + ) + lats = np.sin(np.radians(np.arange(0, 361, 1))) * radius / meter_1deg_lat + lat + lngs = np.cos(np.radians(np.arange(0, 361, 1))) * radius / meter_1deg_lng + lng return np.array([lats, lngs]).T @@ -115,20 +119,29 @@ def jma_amesh( jma_timestamp = get_latest_timestamps() h = HatoMap( - basemap='open-street-map-dim', + basemap="open-street-map-dim", title=f'雨雲:{timestamp2jst(jma_timestamp["hrpns_nd"])} 雷:{timestamp2jst(jma_timestamp["liden"])}', mapbox=MapBox(center=GeoCoord(lat, lng), zoom=zoom), layers=[ - RasterLayer(url=get_jma_image_server( - jma_timestamp["hrpns_nd"]), opacity=128 / 256) - ] + [ - LineTrace(coords=[get_circle(lat, lng, d * 1000)], - color=(100, 100, 100, 255)) - for d in range(10, 60, 10) - ] + [ - MarkerTrace([GeoCoord(e[0], e[1]) for e in get_liden(jma_timestamp["liden"])], size=14, - symbol='thunder', fill_color=(0, 255, 255, 255), border_color=(0, 64, 64, 255)) + RasterLayer( + url=get_jma_image_server(jma_timestamp["hrpns_nd"]), opacity=128 / 256 + ) ] + + [ + LineTrace( + coords=[get_circle(lat, lng, d * 1000)], color=(100, 100, 100, 255) + ) + for d in range(10, 60, 10) + ] + + [ + MarkerTrace( + [GeoCoord(e[0], e[1]) for e in get_liden(jma_timestamp["liden"])], + size=14, + symbol="thunder", + fill_color=(0, 255, 255, 255), + border_color=(0, 64, 64, 255), + ) + ], ) width = (2 * around_tiles + 1) * 256 i = h.get_image(width=width, height=width) diff --git a/tests/plugins/test_hato.py b/tests/plugins/test_hato.py index 80aabc3861..1cfff831e1 100644 --- a/tests/plugins/test_hato.py +++ b/tests/plugins/test_hato.py @@ -60,12 +60,14 @@ class TestAmesh(unittest.TestCase): ameshが正しく動作しているかテストする """ - def get_amesh_test(self, - mocker: requests_mock.Mocker, - place: str, - image_content=None, - json_content=None, - liden_json_content=None): + def get_amesh_test( + self, + mocker: requests_mock.Mocker, + place: str, + image_content=None, + json_content=None, + liden_json_content=None + ): """ ameshを取得できるかテスト :param mocker requestsのMock @@ -75,13 +77,14 @@ def get_amesh_test(self, """ client1 = TestClient() - jma_image_url = re.compile( - r'www\.jma\.go\.jp/bosai/jmatile/data/nowc/.+\.png') + jma_image_url = re.compile(r'www\.jma\.go\.jp/bosai/jmatile/data/nowc/.+\.png') osm_image_url = re.compile(r'tile\.openstreetmap\.org/.+\.png') jma_json_url = re.compile( - r'www.jma.go.jp/bosai/jmatile/data/nowc/targetTimes_N\d.json') + r'www.jma.go.jp/bosai/jmatile/data/nowc/targetTimes_N\d.json' + ) liden_json_url = re.compile( - r'www.jma.go.jp/bosai/jmatile/data/nowc/.+/liden/data.geojson') + r'www.jma.go.jp/bosai/jmatile/data/nowc/.+/liden/data.geojson' + ) mocker.get(jma_image_url, content=image_content) mocker.get(osm_image_url, content=image_content) @@ -98,20 +101,25 @@ def amesh_upload_png_test(self, mocker: requests_mock.Mocker, place: str, msg: s :param place: コマンドの引数 :param msg: Slackに投稿されて欲しいメッセージ """ - with open(os.path.join(os.path.dirname(__file__), 'test.png'), mode='rb') as picture_file: - with open(os.path.join(os.path.dirname(__file__), 'test_targetTimes_N1.json' - ), mode='rb') as json_file: - with open(os.path.join( - os.path.dirname(__file__), 'test_liden_data.geojson' - ), mode='rb') as liden_json_file: - client1 = self.get_amesh_test(mocker, - place, - image_content=picture_file.read(), - json_content=json_file.read(), - liden_json_content=liden_json_file.read() - ) - self.assertEqual(client1.get_post_message(), msg) - self.assertEqual(client1.get_filename(), 'amesh.png') + with open( + os.path.join(os.path.dirname(__file__), "test.png"), mode="rb" + ) as picture_file: + with open( + os.path.join(os.path.dirname(__file__), "test_targetTimes_N1.json"), + mode="rb", + ) as json_file: + with open( + os.path.join(os.path.dirname(__file__), "test_liden_data.geojson"), + mode="rb", + ) as liden_json_file: + client1 = self.get_amesh_test( + mocker, + place, + image_content=picture_file.read(), + json_content=json_file.read(), + liden_json_content=liden_json_file.read(), + ) + self.assertEqual(client1.get_filename(), "amesh.png") def test_amesh_with_no_params(self): """