mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-16 04:35:49 +00:00
🎨 删除旧单元测试并修改部分测试
This commit is contained in:
parent
7095d975ac
commit
462013ac1e
@ -44,6 +44,9 @@ class ArtifactOcrRate:
|
||||
def __init__(self):
|
||||
self.client = httpx.AsyncClient(headers=self.HEADERS)
|
||||
|
||||
async def close(self):
|
||||
await self.client.aclose()
|
||||
|
||||
async def get_artifact_attr(self, photo_byte):
|
||||
b64_str = b64encode(photo_byte).decode()
|
||||
req = await self.client.post(self.OCR_URL, json={"image": b64_str}, timeout=8)
|
||||
|
@ -21,6 +21,9 @@ class TestArtifact(IsolatedAsyncioTestCase):
|
||||
{'type': 'cd', 'name': '暴击伤害', 'value': '10.9%'}]}
|
||||
await self.artifact_rate.rate_artifact(artifact_attr)
|
||||
|
||||
async def asyncTearDown(self) -> None:
|
||||
await self.artifact_rate.close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
@ -1,28 +0,0 @@
|
||||
import json
|
||||
import unittest
|
||||
|
||||
from models.base import GameItem
|
||||
from models.game.artifact import ArtifactInfo
|
||||
|
||||
|
||||
class TestBase(unittest.TestCase):
|
||||
def test_game_item(self):
|
||||
test_dict = {"item_id": 0, "name": "攻击力", "type": "atk", "value": 2333}
|
||||
test_json = json.dumps(test_dict)
|
||||
test_game_item = GameItem(0, "攻击力", "atk", 2333)
|
||||
new_json = test_game_item.to_json()
|
||||
self.assertEqual(new_json, test_json)
|
||||
|
||||
def test_artifact(self):
|
||||
test_dict = {"item_id": 0, "name": "测试花", "pos": "测试属性", "star": 2333,
|
||||
"sub_item": [{"item_id": 0, "name": "攻击力", "type": "atk", "value": 2333}],
|
||||
"main_item": {"item_id": 0, "name": "攻击力", "type": "atk", "value": 2333}, "level": 2333}
|
||||
test_json = json.dumps(test_dict)
|
||||
test_game_item = GameItem(0, "攻击力", "atk", 2333)
|
||||
test_artifact = ArtifactInfo(0, "测试花", 2333, test_game_item, "测试属性", 2333, [test_game_item])
|
||||
new_json = test_artifact.to_json()
|
||||
self.assertEqual(test_json, new_json)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Loading…
Reference in New Issue
Block a user