forked from john-kurkowski/tldextract
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: cache entire public suffix list. Select at runtime.
Addresses john-kurkowski#66 but is not backwards compatible.
- Loading branch information
1 parent
d40fc51
commit 4c29a8b
Showing
11 changed files
with
12,945 additions
and
7,481 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ tldextract_app/tldextract | |
tldextract_app/web | ||
tldextract.egg-info | ||
.tox | ||
tldextract/.suffix_cache/* | ||
.pytest_cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,12 @@ | ||
'''tldextract integration tests.''' | ||
|
||
import logging | ||
import os | ||
import traceback | ||
|
||
import pytest | ||
|
||
import tldextract | ||
|
||
|
||
def test_log_snapshot_diff(mocker): | ||
mocker.patch.object(logging.getLogger(), 'level', logging.DEBUG) | ||
debug_mock = mocker.patch.object(logging.getLogger('tldextract'), 'debug') | ||
|
||
extractor = tldextract.TLDExtract() | ||
try: | ||
os.remove(extractor.cache_file) | ||
except (IOError, OSError): | ||
logging.warning(traceback.format_exc()) | ||
|
||
extractor('ignore.com') | ||
|
||
assert debug_mock.call_count == 1 | ||
log_str = debug_mock.call_args[0][0] | ||
assert log_str.startswith('computed TLD diff') | ||
|
||
|
||
def test_bad_kwargs(): | ||
with pytest.raises(ValueError): | ||
tldextract.TLDExtract( | ||
cache_file=False, suffix_list_urls=False, fallback_to_snapshot=False | ||
cache_dir=False, suffix_list_urls=False, fallback_to_snapshot=False | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.