Skip to content

Commit

Permalink
Use PSL support from url-cpp.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Lecocq committed Aug 17, 2016
1 parent 0d58ce7 commit 011c63a
Show file tree
Hide file tree
Showing 8 changed files with 12,460 additions and 903 deletions.
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ coverage==4.1
Cython==0.24.1
nose==1.3.7
nose-timer==0.6.0
publicsuffix==1.1.0
python-termstyle==0.1.10
rednose==1.2.1
termcolor==1.1.0
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
ext_files = [
'url/url-cpp/src/url.cpp',
'url/url-cpp/src/utf8.cpp',
'url/url-cpp/src/punycode.cpp'
'url/url-cpp/src/punycode.cpp',
'url/url-cpp/src/psl.cpp'
]

kwargs = {}
Expand All @@ -50,7 +51,7 @@

setup(
name = 'url',
version = '0.3.0rc1',
version = '0.3.0rc2',
description = 'URL Parsing',
long_description = '''
Some helper functions for parsing URLs, sanitizing them, normalizing them.
Expand All @@ -77,8 +78,10 @@
package_dir = {
'url': 'url'
},
package_data = {
'url': ['psl/*']
},
install_requires = [
'publicsuffix'
],
tests_require = [
'coverage',
Expand Down
18 changes: 14 additions & 4 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,9 +574,14 @@ def test(query, result):
assert_equal(url.parse(query).pld, result)

examples = [
('http://foo.com/bar' , 'foo.com'),
('http://bar.foo.com/bar', 'foo.com'),
('/foo' , '')
('http://foo.com/bar' , 'foo.com'),
('http://bar.foo.com/bar' , 'foo.com'),
('/foo' , ''),
('http://com/bar' , ''),
('http://foo.გე' , 'foo.გე'),
('http://bar.foo.გე' , 'foo.გე'),
('http://foo.xn--node' , 'foo.xn--node'),
('http://bar.foo.xn--node', 'foo.xn--node')
]
for query, result in examples:
yield test, query, result
Expand All @@ -589,7 +594,12 @@ def test(query, result):
examples = [
('http://foo.com/bar' , 'com'),
('http://bar.foo.com/bar', 'com'),
('/foo' , '')
('/foo' , ''),
('http://com/bar' , 'com'),
('http://foo.გე' , 'გე'),
('http://bar.foo.გე' , 'გე'),
('http://foo.xn--node' , 'xn--node'),
('http://bar.foo.xn--node', 'xn--node')
]
for query, result in examples:
yield test, query, result
Expand Down
Loading

0 comments on commit 011c63a

Please sign in to comment.