Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pygeoip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pygeoip
Commits
a4d3785f
Commit
a4d3785f
authored
Sep 29, 2012
by
William Tisäter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unicode output test
parent
43d5b014
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
tests/test_unicode.py
+18
-0
No files found.
tests/test_unicode.py
0 → 100644
View file @
a4d3785f
# -*- coding: utf-8 -*-
import
unittest
import
pygeoip
from
pygeoip.const
import
PY2
,
PY3
from
tests.config
import
CITY_DB_PATH
class
TestGeoIPCacheMethods
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
de_hostname
=
'www.osnabrueck.de'
self
.
de_city
=
'Osnabr
\xfc
ck'
.
decode
(
'latin1'
)
if
PY2
else
'Osnabrück'
self
.
gic
=
pygeoip
.
GeoIP
(
CITY_DB_PATH
)
def
testUnicodeCity
(
self
):
record
=
self
.
gic
.
record_by_name
(
self
.
de_hostname
)
self
.
assertEqual
(
type
(
record
[
'city'
]),
unicode
if
PY2
else
str
)
self
.
assertEqual
(
record
[
'city'
],
self
.
de_city
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment