After changes in https://github.com/betcode-org/flumine/pull/693, utils.get_file_md no longer gracefully handles the case where the first line of the file contains a non-empty mc list where the first element is missing a marketDefinition field
The fix is to guard against the marketDefinition field being missing and to return None if that is the case. A new unit test has been added which fails under the old code but passes with the added guard
After changes in https://github.com/betcode-org/flumine/pull/693,
utils.get_file_md
no longer gracefully handles the case where the first line of the file contains a non-emptymc
list where the first element is missing amarketDefinition
fieldOn this line: https://github.com/betcode-org/flumine/blob/0241aca36f751bf1e35c5f8d7242735d2f1a5687/flumine/utils.py#L80 if the field is missing then
md
is set to a default value of an empty dictionary. However, it is not possible to then construct aMarketDefinition
object from an empty dictionary on the following line: https://github.com/betcode-org/flumine/blob/0241aca36f751bf1e35c5f8d7242735d2f1a5687/flumine/utils.py#L81 as the following exception gets thrown:The fix is to guard against the
marketDefinition
field being missing and to returnNone
if that is the case. A new unit test has been added which fails under the old code but passes with the added guard