|
8 | 8 | PlayReq, PlayState, PowerType, State, Step, Zone |
9 | 9 | ) |
10 | 10 |
|
11 | | -from hslog import LogParser |
| 11 | +from hslog import LogParser, packets |
12 | 12 | from hslog.exceptions import ParsingError |
13 | 13 | from hslog.export import FriendlyPlayerExporter |
14 | 14 | from hslog.parser import parse_initial_tag |
@@ -416,3 +416,27 @@ def test_sub_spell_battlegrounds(): |
416 | 416 | assert sub_spell_packet.source is None |
417 | 417 | assert sub_spell_packet.target_count == 0 |
418 | 418 | assert sub_spell_packet.targets == [] |
| 419 | + |
| 420 | + |
| 421 | +def test_options_missing_block_end(): |
| 422 | + parser = LogParser() |
| 423 | + parser.read(StringIO(data.INITIAL_GAME)) |
| 424 | + |
| 425 | + parser.read(StringIO( |
| 426 | + "D 09:01:05.7959635 GameState.DebugPrintPower() - BLOCK_START BlockType=ATTACK Entity=[entityName=Rat Pack id=2974 zone=PLAY zonePos=2 cardId=CFM_316 player=3] EffectCardId= EffectIndex=1 Target=0 SubOption=-1 \n" # noqa |
| 427 | + "D 09:01:05.7959635 GameState.DebugPrintPower() - BLOCK_START BlockType=TRIGGER Entity=[entityName=3ofKindCheckPlayerEnchant id=3319 zone=PLAY zonePos=0 cardId=TB_BaconShop_3ofKindChecke player=3] EffectCardId= EffectIndex=-1 Target=0 SubOption=-1 TriggerKeyword=0\n" # noqa |
| 428 | + "D 09:01:05.7959635 GameState.DebugPrintPower() - BLOCK_END\n" # noqa |
| 429 | + "D 09:01:05.7959635 GameState.DebugPrintPower() - TAG_CHANGE Entity=BehEh#1355 tag=NUM_OPTIONS_PLAYED_THIS_TURN value=15 \n" # noqa |
| 430 | + "D 09:01:05.8620235 GameState.DebugPrintOptions() - id=76\n" # noqa |
| 431 | + "D 09:01:05.8620235 GameState.DebugPrintOptions() - option 0 type=END_TURN mainEntity= error=INVALID errorParam=\n" # noqa |
| 432 | + )) |
| 433 | + parser.flush() |
| 434 | + |
| 435 | + packet_tree = parser.games[0] |
| 436 | + |
| 437 | + block_without_end = packet_tree.packets[1] |
| 438 | + assert isinstance(block_without_end, packets.Block) |
| 439 | + assert block_without_end.ended |
| 440 | + |
| 441 | + options_packet = packet_tree.packets[-1] |
| 442 | + assert isinstance(options_packet, packets.Options) |
0 commit comments