def deserialize_hook(self, pairs): d = OrderedDict(pairs) if "timeStamp" in d: d["timeStamp"] = d["timeStamp"]["secondsPastEpoch"] + \ float(d["timeStamp"]["nanoseconds"]) * 1e-9 if "name" in d and "version" in d and d["name"].startswith("V"): typ = VType.subclasses()[d["name"]] if typ == VEnum: d = typ(d["labels"]) else: d = typ return d
def test_all_subclasses(self): self.assertIn(VDouble, VType.subclasses().values()) self.assertNotIn(VNumber, VType.subclasses().values())