Skip to content

Commit

Permalink
revierto commits en branch equivocado
Browse files Browse the repository at this point in the history
  • Loading branch information
lrromero committed Jul 6, 2018
1 parent 29ec09b commit 0514d95
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 165 deletions.
4 changes: 1 addition & 3 deletions pydatajson/indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,12 @@ def _generate_indicators(catalog, validator=None, only_numeric=False):
if not only_numeric:
if 'dataset' in catalog:
format_count = count_fields(get_distributions(catalog), 'format')
type_count = count_fields(get_distributions(catalog), 'type')
license_count = count_fields(get_datasets(catalog), 'license')
else:
format_count = license_count = type_count = {}
format_count = license_count = {}

result.update({
'distribuciones_formatos_cant': format_count,
'distribuciones_tipos_cant': type_count,
'datasets_licencias_cant': license_count,
})

Expand Down
110 changes: 0 additions & 110 deletions tests/samples/several_datasets_with_types.json

This file was deleted.

53 changes: 1 addition & 52 deletions tests/test_indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,24 +117,6 @@ def test_license_indicators(self):
for k, v in expected.items():
assert_equal(indicators[k], v)

@my_vcr.use_cassette()
def test_types_indicators(self):
catalog = os.path.join(self.SAMPLES_DIR, "several_datasets_with_types.json")

indicators = self.dj.generate_catalogs_indicators(catalog)[0][0]

expected = {
'distribuciones_tipos_cant': {
"file": 1,
"file.upload": 1,
"documentation": 1,
"api": 2
}
}

for k, v in expected.items():
assert_equal(indicators[k], v)

@my_vcr.use_cassette()
def test_no_licenses_indicators(self):
# No tienen licencias
Expand Down Expand Up @@ -280,10 +262,6 @@ def test_network_indicators(self):
'XLSX': 1,
'PDF': 2
},
'distribuciones_tipos_cant': {
'file': 1,
'documentation': 1
},
'datasets_licencias_cant': {
'Open Data Commons Open Database License 1.0': 2,
},
Expand Down Expand Up @@ -316,36 +294,7 @@ def test_network_license_indicators(self):
}

for k, v in expected.items():
assert_equal(network_indicators[k], v, k)

@my_vcr.use_cassette()
def test_network_license_indicators(self):
one_catalog = os.path.join(self.SAMPLES_DIR, "several_datasets_with_types.json")
other_catalog = os.path.join(self.SAMPLES_DIR, "full_data.json")

indicators, network_indicators = self.dj.generate_catalogs_indicators([
one_catalog,
other_catalog
])
# Esperado: 1 file en full, 1 en several
# 1 file.upload en several
# 1 documentation en full, 1 en several
# 2 api en several
# 1 distribucion en several sin tipo
expected = {
'catalogos_cant': 2,
'distribuciones_cant': 8,
'distribuciones_tipos_cant': {
"file": 2,
"file.upload": 1,
"documentation": 2,
"api": 2
}
}

for k, v in expected.items():
assert_equal(network_indicators[k], v, k)

assert_equal(network_indicators[k], v)

def test_network_federation_indicators(self):
one_catalog = os.path.join(self.SAMPLES_DIR, "several_datasets.json")
Expand Down

0 comments on commit 0514d95

Please sign in to comment.