Working advanced tracking code
Build / Build source distribution (push) Failing after 13s
Build / Execute unit tests (push) Failing after 8s
Build / Verify generated game data is current (push) Failing after 7s
Build / Upload Release Asset (push) Has been skipped
Build / upload_pypi (push) Has been skipped
Build / Build source distribution (push) Failing after 13s
Build / Execute unit tests (push) Failing after 8s
Build / Verify generated game data is current (push) Failing after 7s
Build / Upload Release Asset (push) Has been skipped
Build / upload_pypi (push) Has been skipped
This commit is contained in:
@@ -113,6 +113,53 @@ def test_summarize_reports_fame_silver_and_player():
|
||||
assert 'packets: 42' in report
|
||||
|
||||
|
||||
def test_summarize_breaks_damage_down_per_player():
|
||||
"""A combined total next to "main player" reads as that player's damage.
|
||||
|
||||
Two players damaged a mob; the report must attribute each share rather
|
||||
than printing one ambiguous number.
|
||||
"""
|
||||
events = [
|
||||
{'name': 'MainPlayerAppeared', 'value': {'id': 0, 'name': 'Alice'}},
|
||||
{'name': 'PlayerAppeared', 'value': {'id': 1, 'name': 'Bob'}},
|
||||
{'name': 'DamageDone', 'value': {'source': 1, 'value': 1309.0}},
|
||||
{'name': 'DamageDone', 'value': {'source': 1, 'value': 100.0}},
|
||||
{'name': 'DamageDone', 'value': {'source': 0, 'value': 232.0}},
|
||||
{'name': 'DamageTaken', 'value': {'source': 1, 'value': 244.0}},
|
||||
]
|
||||
|
||||
report = summarize(events)
|
||||
|
||||
assert 'Bob: 1409.00' in report
|
||||
assert 'Alice: 232.00' in report
|
||||
# the party-wide figure is still reported, but labelled as such
|
||||
assert 'damage done: 1641.00 (all players)' in report
|
||||
assert 'damage taken by player:' in report
|
||||
assert 'Bob: 244.00' in report
|
||||
|
||||
|
||||
def test_summarize_labels_unknown_player_ids():
|
||||
events = [
|
||||
{'name': 'MainPlayerAppeared', 'value': {'id': 0, 'name': 'Alice'}},
|
||||
{'name': 'DamageDone', 'value': {'source': 7, 'value': 50.0}},
|
||||
]
|
||||
|
||||
report = summarize(events)
|
||||
|
||||
# no appearance event for id 7, so it must not be silently attributed
|
||||
assert 'player #7: 50.00' in report
|
||||
|
||||
|
||||
def test_summarize_reports_empty_damage_sections():
|
||||
report = summarize([
|
||||
{'name': 'MainPlayerAppeared', 'value': {'id': 0, 'name': 'Alice'}},
|
||||
])
|
||||
|
||||
assert 'damage done by player:' in report
|
||||
assert 'damage taken by player:' in report
|
||||
assert '(none)' in report
|
||||
|
||||
|
||||
pytestmark = pytest.mark.skipif(
|
||||
not os.path.exists(RAW_LOG_PATH),
|
||||
reason='aoaddons.log capture fixture is not available')
|
||||
|
||||
Reference in New Issue
Block a user