From 525f0b05e7f9503582460c7054503b46c1a2feb5 Mon Sep 17 00:00:00 2001 From: A_D Date: Wed, 30 Dec 2020 20:55:28 +0200 Subject: [PATCH] Added doctest --- monitor.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/monitor.py b/monitor.py index 484ca1c7..3ecb3a0a 100644 --- a/monitor.py +++ b/monitor.py @@ -978,6 +978,14 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below side, this is represented as multiple entries in the `Inventory` List with the same names etc. Just a differing MissionID. We (as in EDMC Core) dont want to support the multiple mission IDs, but DO want to have correct cargo counts. Thus, we reduce all existing cargo down to one total. + >>> test = [ + ... { "Name":"basicmedicines", "Name_Localised":"BM", "MissionID":684359162, "Count":147, "Stolen":0 }, + ... { "Name":"survivalequipment", "Name_Localised":"SE", "MissionID":684358939, "Count":147, "Stolen":0 }, + ... { "Name":"survivalequipment", "Name_Localised":"SE", "MissionID":684359344, "Count":36, "Stolen":0 } + ... ] + >>> EDLogs().coalesce_cargo(test) # doctest: +NORMALIZE_WHITESPACE + [{'Name': 'basicmedicines', 'Name_Localised': 'BM', 'MissionID': 684359162, 'Count': 147, 'Stolen': 0}, + {'Name': 'survivalequipment', 'Name_Localised': 'SE', 'MissionID': 684358939, 'Count': 183, 'Stolen': 0}] :param raw_cargo: Raw cargo data (usually from Cargo.json) :return: Coalesced data