The Fru class constructor modifies initdict
OlekTk opened this issue · comments
I would like to initialize several Fru class instances from a common initialization dictionary (changing only the serial number in between). Unfortunately, after constructing the first Fru object, creating another one fails. Here is the minimal test case:
from frugy.fru import Fru
dict = {'MultirecordArea': [{'type': 'ModuleCurrentRequirements', 'current_draw': 4.0}]}
Fru(dict)
print("1st done")
Fru(dict)
print("2nd done")
After running it, I see "1st done" printed out, and then an exception is thrown before the second print.
Somehow the 'type' element gets removed from the initialization dictionary. I believe this was not an intended behavior.
Tested on version 0.4.0 installed by pip.
Best regards,
Aleksander from DMCS
Fixed c62538d