def hard_test1(): assert address_line_solution("4, rue de la revolution") == j({ "street": "rue de la revolution", "housenumber": "4" })
def get1(request): data = {'post': 'name1', 'data': 'name2'} data = j(data) callback = request.GET['callback'] #print data print request.GET return HttpResponse('%s(%s)' % (callback, data))
def hard_test4(): assert address_line_solution("Calle 39 No 1540") == j({ "street": "Calle 39", "housenumber": "No 1540" })
def medium_test2(): assert address_line_solution("Auf der Vogelwiese 23 b") == j({ "street": "Auf der Vogelwiese", "housenumber": "23 b" })
def get1(request): data = { 'post': 'name1', 'data': 'name2' } data = j(data) callback = request.GET['callback'] #print data print request.GET return HttpResponse( '%s(%s)' % (callback,data))
def address_line_solution(address: str) -> dict: pattern = '(No |no |NO )\d+|\d+(,|$|\w$)|, \d+|^\d+|\d+(?! No|no|NO) \w+' match = re.search(pattern, address) match_el = match.group() if match else '' house_number = match_el.replace(',', '').strip() street = address.replace(match_el, '').strip() result = {'street': street, 'housenumber': house_number} return j(result)
def jquery_equivalent(element): """Command to get the jQuery DOM element corresponding to an :class:`Element`. :rtype: str """ return "$({})".format(j(selector(element)))
def empty_address_test(): assert address_line_solution("") == j({"street": "", "housenumber": ""})
def hard_test3(): assert address_line_solution("Calle Aduana, 29") == j({ "street": "Calle Aduana", "housenumber": "29" })
def hard_test2(): assert address_line_solution("200 Broadway Av") == j({ "street": "Broadway Av", "housenumber": "200" })
def easy_test1(): assert address_line_solution("Winterallee 3") == j({ "street": "Winterallee", "housenumber": "3" })
def medium_test1(): r = address_line_solution("Am Bächle 23") assert address_line_solution("Am Bächle 23") == j({ "street": "Am Bächle", "housenumber": "23" })
def easy_test3(): assert address_line_solution("Blaufeldweg 123B") == j({ "street": "Blaufeldweg", "housenumber": "123B" })
def easy_test2(): assert address_line_solution("Musterstrasse 45") == j({ "street": "Musterstrasse", "housenumber": "45" })