def json_repr(self, minimal=False): """Construct a JSON-friendly representation of the object. :param bool minimal: Construct a minimal representation of the object (ignore nulls and empty collections) :rtype: dict """ if minimal: return {to_camel_case(k):v for k,v in vars(self).items() if (v or v == False)} else: return {to_camel_case(k):v for k,v in vars(self).items()}
def test(camel, snake): assert to_camel_case(snake) == camel