def test_assignment_json_serde(): asns = Assignments('test', 8, tp1, 12345, 1) jsonOut = asns.asJson() print(jsonOut) asnsDeser = Assignments.fromJson(jsonOut) assert asns.version == asnsDeser.version assert asns.group == asnsDeser.group assert asns.maxMembers == asnsDeser.maxMembers assert asns.configVersion == asnsDeser.configVersion assert len(asns.memberAssignments) == len(asnsDeser.memberAssignments) assert len(asns.topics) == len(asnsDeser.topics)
def _processAssignmentsData(self, rawData): if rawData is not None: return Assignments.fromJson(rawData.decode('utf-8'))
def test_assignment_json_bad_input(jsonStr): rs = Assignments.fromJson(jsonStr) assert rs is None
def test_assignment_json_bad(): rs = Assignments.fromJson('{some: bad json}') assert rs is None
def assignments(): return Assignments.fromJson(good_assignment_json)