-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
93 additions
and
14 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
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
"""Tests for registry module - datasets methods""" | ||
import os | ||
from pygbif import registry | ||
|
||
def test_datasets(): | ||
"registry.datasets - basic test" | ||
res = registry.datasets() | ||
assert dict == res.__class__ | ||
|
||
def test_datasets_limit(): | ||
"registry.datasets - limit param" | ||
res = registry.datasets(limit=1) | ||
assert dict == res.__class__ | ||
assert 1 == len(res['results']) | ||
|
||
res = registry.datasets(limit=3) | ||
assert dict == res.__class__ | ||
assert 3 == len(res['results']) | ||
|
||
def test_datasets_type(): | ||
"registry.datasets - type param" | ||
res = registry.datasets(type="OCCURRENCE") | ||
vv = [ x['type'] for x in res['results'] ] | ||
assert dict == res.__class__ | ||
assert 100 == len(res['results']) | ||
assert 'OCCURRENCE' == list(set(vv))[0] | ||
|
||
def test_dataset_metrics(): | ||
"registry.dataset_metrics - basic test" | ||
res = registry.dataset_metrics(uuid='3f8a1297-3259-4700-91fc-acc4170b27ce') | ||
assert dict == res.__class__ | ||
assert 19 == len(res) | ||
|
||
def test_dataset_metrics_multiple_uuids(): | ||
"registry.dataset_metrics - multiple uuids" | ||
uuids = ['3f8a1297-3259-4700-91fc-acc4170b27ce', '66dd0960-2d7d-46ee-a491-87b9adcfe7b1'] | ||
res = registry.dataset_metrics(uuids) | ||
assert list == res.__class__ | ||
assert 2 == len(res) |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# """Tests for registry module - nodes methods""" | ||
# import os | ||
# from pygbif import registry | ||
|
||
# def test_nodes(): | ||
# "Basic test of registry.nodes" | ||
# res = registry.nodes() | ||
# assert 'dict' == res.__class__.__name__ | ||
# assert 5 == len(res) | ||
# assert [u'count', u'endOfRecords', u'limit', u'results', u'offset'] == res.keys() | ||
|
||
# def test_nodes_limit(): | ||
# "limit param in registry.nodes" | ||
# res = registry.nodes(limit=5) | ||
# assert 'dict' == res.__class__.__name__ | ||
# assert 24 == len(res) | ||
# assert 252408386 == res['key'] | ||
|
||
# def test_nodes_return(): | ||
# "data param in registry.nodes" | ||
# res = registry.nodes(taxonKey = 1052909293) | ||
# assert 'dict' == res.__class__.__name__ | ||
# assert 5 == len(res) |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"""Tests for species module - name_backbone methods""" | ||
import os | ||
from pygbif import species | ||
|
||
def test_name_backbone(): | ||
"species.name_backbone - basic test" | ||
res = species.name_backbone(name='Helianthus annuus') | ||
assert dict == res.__class__ | ||
assert 22 == len(res) | ||
assert 'Helianthus annuus' == res['species'] | ||
|
||
def test_name_backbone_multiple_matches(): | ||
"species.name_backbone - multiple matches" | ||
res = species.name_backbone(name='Aso') | ||
assert dict == res.__class__ | ||
assert 4 == len(res) | ||
assert 'Multiple equal matches for Aso' == res['note'] |