Beispiel #1
0
def hard_test1():
    assert address_line_solution("4, rue de la revolution") == j({
        "street":
        "rue de la revolution",
        "housenumber":
        "4"
    })
Beispiel #2
0
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))
Beispiel #3
0
def hard_test4():
    assert address_line_solution("Calle 39 No 1540") == j({
        "street":
        "Calle 39",
        "housenumber":
        "No 1540"
    })
Beispiel #4
0
def medium_test2():
    assert address_line_solution("Auf der Vogelwiese 23 b") == j({
        "street":
        "Auf der Vogelwiese",
        "housenumber":
        "23 b"
    })
Beispiel #5
0
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))
Beispiel #6
0
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)
Beispiel #7
0
def jquery_equivalent(element):
  """Command to get the jQuery DOM element corresponding to an :class:`Element`.

  :rtype: str
  """
  return "$({})".format(j(selector(element)))
Beispiel #8
0
def empty_address_test():
    assert address_line_solution("") == j({"street": "", "housenumber": ""})
Beispiel #9
0
def hard_test3():
    assert address_line_solution("Calle Aduana, 29") == j({
        "street": "Calle Aduana",
        "housenumber": "29"
    })
Beispiel #10
0
def hard_test2():
    assert address_line_solution("200 Broadway Av") == j({
        "street": "Broadway Av",
        "housenumber": "200"
    })
Beispiel #11
0
def easy_test1():
    assert address_line_solution("Winterallee 3") == j({
        "street": "Winterallee",
        "housenumber": "3"
    })
Beispiel #12
0
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"
    })
Beispiel #13
0
def easy_test3():
    assert address_line_solution("Blaufeldweg 123B") == j({
        "street": "Blaufeldweg",
        "housenumber": "123B"
    })
Beispiel #14
0
def easy_test2():
    assert address_line_solution("Musterstrasse 45") == j({
        "street": "Musterstrasse",
        "housenumber": "45"
    })