示例#1
0
def deserialize_command(command):
    classname = dash_to_pascalcase(command["name"])
    del command["name"]
    command_type = commands.__dict__[classname]
    command["command_time"] = datetime.now()
    return command_type(**command)
 def test_dash_to_pascalcase(self):
     self.assertEqual("AndersTester", dash_to_pascalcase("anders-tester"))
     self.assertEqual("AndersTesterMange", dash_to_pascalcase("anders-tester-mange"))
     self.assertEqual("AndersTesterIOb", dash_to_pascalcase("anders-tester-i-ob"))
     self.assertEqual("AndersTesterIOb", dash_to_pascalcase("anders_tester_i_ob", "_"))