def test_session_info_canbe_detected(self): program = deim.loadProgramInfoFromJsonData( u"{\"timetable\":[\"セッション1:3月6日(月) 15:20〜16:35\",\"セッション2:3月7日(火) 8:45〜10:15\",]}", "") slots = deim.getSlotInfo(program) self.assertEqual(slots["1"]["session_no"], "1") self.assertEqual(slots["1"]["date"], "3/6") self.assertEqual(slots["1"]["day"], 1) self.assertEqual(slots["1"]["start"], "15:20") self.assertEqual(slots["1"]["end"], "16:35") self.assertEqual(slots["2"]["session_no"], "2") self.assertEqual(slots["2"]["date"], "3/7") self.assertEqual(slots["2"]["day"], 2) self.assertEqual(slots["2"]["start"], "8:45") self.assertEqual(slots["2"]["end"], "10:15")
def test_session_info_cannotbe_detected_from_invalid_format(self): program = deim.loadProgramInfoFromJsonData( u"{\"timetable\":[\"セッション1:3月6日(月) 15:20〜16:35\",\"セッション2:3月7日(火) 8:45〜10:15\",]}", "") self.assertRaises(Exception, deim.getSlotInfo(program))
presen.extend([authors[0]["name_last"]+" "+authors[0]["name_first"],authors[0]["organization"], position[authors[0]["position_title"]],day]) for author in authors: presen.append(author["name_last"]+" "+author["name_first"]+"("+author["organization"]+")") return presen else: raise # main procedure if __name__ == '__main__': data_papers = 'http://cms.deim-forum.org/deim2016/list/papers.php?decode&pretty&jsonp=callback' papers = deim.getPaperInfo(data_papers) data_program = 'http://db-event.jpn.org/deim2016/data_program.js' program = deim.loadProgramInfo(data_program,'var sessions =') slots = deim.getSlotInfo(program) # list up oral presentations for room in program["oral"]: for sessionID in program["oral"][room]: i = 1 for paperID in program["oral"][room][sessionID]: try: print ','.join(generatePresentationInfo(room,sessionID,paperID, i, papers,slots[sessionID]["date"])).encode('utf-8') i = i + 1 except: sys.stderr.write('ERROR: the paper (ID:'+paperID+") is not found. \n") # list up poster presentations for sessionID in program["interactive"]["P"]: i = 1 for paperID in program["interactive"]["P"][sessionID]:
['"' + ",".join(names) + '"', '"' + ",".join(affrs) + '"']) else: for i in range(1, nofreviewers + 1): session.extend(["TBD", "TBD"]) return session # main procedure if __name__ == '__main__': data_program = 'http://db-event.jpn.org/deim2017/data_program.js' data_reviewer = 'http://db-event.jpn.org/deim2017/data_reviewers.js' try: program = deim.loadProgramInfo(data_program, 'var sessions =') reviewer = deim.loadProgramInfo(data_reviewer, 'var reviewers =') except: sys.stderr.write("cannot load the json data") sys.exit slots = deim.getSlotInfo(program) rooms = sorted(program["sessions"], key=lambda x: x[0]) for room in rooms: sessions = sorted(program["sessions"][room], key=lambda x: x[0]) for sessionID in sessions: session = generateSessionInfo(room, sessionID, program["sessions"][room][sessionID], reviewer) print ",".join(session).encode('utf-8')