Exemplo n.º 1
0
def test_border():
    assert tz_lookup(1, 10) == 'Africa/Malabo'
    assert tz_lookup(0.995, 10) == 'Africa/Libreville'
    assert tz_lookup(0.995366, 9.993868) == 'Africa/Malabo'
    assert tz_lookup(0.992871, 10.003417) == 'Africa/Libreville'

    # Other border:
    assert tz_lookup(1.760234, 13.176470) == 'Africa/Libreville'
    assert tz_lookup(1.759548, 13.185225) == 'Africa/Brazzaville'

    assert tz_lookup(0.024526, 13.923454) == 'Africa/Libreville'
    assert tz_lookup(0.05, 13.944998) == 'Africa/Brazzaville'
Exemplo n.º 2
0
def main(argv=sys.argv[1:]):
    aparser = argparse.ArgumentParser(description=__doc__,
                                      usage='python -m tzgeo [-h] lat lon')
    aparser.add_argument('lat')
    aparser.add_argument('lon')

    args = aparser.parse_args(argv)
    result = tzgeo.tz_lookup(args.lat, args.lon)
    if result is not None:
        print(result)
        exit(0)
    else:
        print("No timezone could be found for lat {lat} and lon {lon}.".format(
            lat=args.lat, lon=args.lon),
              file=sys.stderr)
        exit(1)
Exemplo n.º 3
0
def main(argv=sys.argv[1:]):
    aparser = argparse.ArgumentParser(
        description=__doc__,
        usage='python -m tzgeo [-h] lat lon')
    aparser.add_argument('lat')
    aparser.add_argument('lon')

    args = aparser.parse_args(argv)
    result = tzgeo.tz_lookup(args.lat, args.lon)
    if result is not None:
        print(result)
        exit(0)
    else:
        print(
            "No timezone could be found for lat {lat} and lon {lon}.".format(
                lat=args.lat, lon=args.lon),
            file=sys.stderr)
        exit(1)
Exemplo n.º 4
0
def test_overlaps():
    assert tz_lookup(-1, 32) == 'Africa/Dar_es_Salaam'
    assert tz_lookup(-19, 41) is None
    assert tz_lookup(-51, 72) is None