File: test_region.py

package info (click to toggle)
python-geoip 1.3.2-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 344 kB
  • sloc: ansic: 753; python: 248; makefile: 5
file content (15 lines) | stat: -rw-r--r-- 330 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import GeoIP
from nose.tools import assert_equal


def test_region():
    gi = GeoIP.open("tests/data/GeoIPRegion.dat", GeoIP.GEOIP_STANDARD)

    gir = gi.region_by_addr('64.17.254.223')

    region = {
        'region': 'CA',
        'region_name': 'California',
        'country_code': 'US'
    }
    assert_equal(gir, region)