mirror of
https://github.com/Jylpah/blitz-tools.git
synced 2026-10-21 10:17:05 +02:00
py_test-asyncio: testing
This commit is contained in:
1 parent
d5fd2a81e7
commit
2d7de038ae
1 file changed
+27
-1
+27
-1
@@ -270,7 +270,7 @@ def getTitle_old(replayfile: str, title: str, i : int) -> str:
|
||||
return title
|
||||
|
||||
|
||||
def getTitle(replayfile: str, title: str, i : int) -> str:
|
||||
def getTitle(replayfile: str, title: str = None, i : int = 0) -> str:
|
||||
global wg
|
||||
if title == None:
|
||||
try:
|
||||
@@ -302,6 +302,32 @@ def getTitle(replayfile: str, title: str, i : int) -> str:
|
||||
bu.debug('Returning: ' + title)
|
||||
return title
|
||||
|
||||
### UNIT TESTS - pytest
|
||||
|
||||
class TestClass:
|
||||
# def test_getTitle(self):
|
||||
# #player = "jylpah"
|
||||
# WG_appID = '81381d3f45fa4aa75b78a7198eb216ad'
|
||||
# wg = WG(WG_appID, 'tanks.json', 'maps.json')
|
||||
# tank_name = "T28 Defender" # "A68_T28D"
|
||||
# map_name = "Yukon" # "idle"
|
||||
# replay = './test/' + '20201030_2358__jylpah_A_1157485188135816346.wotbreplay'
|
||||
# res = tank_name + ' @ ' + map_name
|
||||
|
||||
# assert getTitle(replay) == res
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_getTitle(self):
|
||||
#player = "jylpah"
|
||||
WG_appID = '81381d3f45fa4aa75b78a7198eb216ad'
|
||||
wg = WG(WG_appID, 'tanks.json', 'maps.json')
|
||||
tank_name = "T28 Defender" # "A68_T28D"
|
||||
map_name = "Yukon" # "idle"
|
||||
replay = './test/' + '20201030_2358__jylpah_A_1157485188135816346.wotbreplay'
|
||||
res = tank_name + ' @ ' + map_name
|
||||
|
||||
assert getTitle(replay) == res
|
||||
|
||||
### main() -------------------------------------------
|
||||
if __name__ == "__main__":
|
||||
# To avoid 'Event loop is closed' RuntimeError due to compatibility issue with aiohttp
|
||||
|
||||
Reference in new issue
Block a user