def test_pascalcase_to_dash(self):
     self.assertEqual("anders-tester", pascalcase_to_dash("AndersTester"))
     self.assertEqual("anders-tester-mange", pascalcase_to_dash("AndersTesterMange"))
     self.assertEqual("anders-tester-iob", pascalcase_to_dash("AndersTesterIOB"))
     self.assertEqual("anders_tester_iob", pascalcase_to_dash("AndersTesterIOB", "_"))
Esempio n. 2
0
def serialize_event(event):
    data = serialize(event)
    data["name"] = pascalcase_to_dash(event.__class__.__name__)
    json_str = json.dumps(data, default=date_handler)
    return json_str
Esempio n. 3
0
 def handle_event(self, event):
     method_name = "handle_" + pascalcase_to_dash(event.__class__.__name__, "_")
     if hasattr(self, method_name):
         getattr(self, method_name)(event)