Skip to content

Commit

Permalink
Fix setup file, fix unit tests
Browse files Browse the repository at this point in the history
 Modifications qui seront validées :
	modifié :         setup.py
	modifié :         MANIFEST.in
	nouveau fichier : .gitignore

	modifié :         ecospold2matrix/test_ecospold2matrix.py
	modifié :         ecospold2matrix/ecospold2matrix.py

	supprimé :        ecospold2matrix/test/STR.csv
	nouveau fichier : ecospold2matrix/test_data/STR.csv

	renommé :         ecospold2matrix/test/datasets/ALL_FAKE_FOR_TESTING_ONLY.txt -> ecospold2matrix/test_data/MasterData/ALL_FAKE_FOR_TESTING_ONLY.txt
	renommé :         ecospold2matrix/test/MasterData/ActivityIndex.xml -> ecospold2matrix/test_data/MasterData/ActivityIndex.xml
	renommé :         ecospold2matrix/test/MasterData/ElementaryExchanges.xml -> ecospold2matrix/test_data/MasterData/ElementaryExchanges.xml
	renommé :         ecospold2matrix/test/MasterData/IntermediateExchanges.xml -> ecospold2matrix/test_data/MasterData/IntermediateExchanges.xml
	renommé :         ecospold2matrix/test/PRO.csv -> ecospold2matrix/test_data/PRO.csv
	renommé :         ecospold2matrix/test/PRO_full.csv -> ecospold2matrix/test_data/PRO_full.csv
	renommé :         ecospold2matrix/test/__init__.py -> ecospold2matrix/test_data/__init__.py
	renommé :         ecospold2matrix/test/activities.csv -> ecospold2matrix/test_data/activities.csv
	renommé :         ecospold2matrix/test/datasets/40011095-059d-465e-bd79-da3b6b3b8308_842e3faf-8de9-47a3-bfac-606edc0aFAKE.spold -> ecospold2matrix/test_data/datasets/40011095-059d-465e-bd79-da3b6b3b8308_842e3faf-8de9-47a3-bfac-606edc0aFAKE.spold
	renommé :         ecospold2matrix/test/MasterData/ALL_FAKE_FOR_TESTING_ONLY.txt -> ecospold2matrix/test_data/datasets/ALL_FAKE_FOR_TESTING_ONLY.txt
	renommé :         ecospold2matrix/test/datasets/c002d7b0-0f0f-4e3e-b600-2acd705a8506_692b4f7e-9e79-4f69-b22f-b66f68f2FAKE.spold -> ecospold2matrix/test_data/datasets/c002d7b0-0f0f-4e3e-b600-2acd705a8506_692b4f7e-9e79-4f69-b22f-b66f68f2FAKE.spold
	renommé :         ecospold2matrix/test/datasets/d0003dc3-4bd3-4422-9c40-8265239e14ff_36dc50ef-017c-4d24-af51-f12ef802FAKE.spold -> ecospold2matrix/test_data/datasets/d0003dc3-4bd3-4422-9c40-8265239e14ff_36dc50ef-017c-4d24-af51-f12ef802FAKE.spold
	renommé :         ecospold2matrix/test/elementary_flows.csv -> ecospold2matrix/test_data/elementary_flows.csv
	renommé :         ecospold2matrix/test/inflows.csv -> ecospold2matrix/test_data/inflows.csv
	renommé :         ecospold2matrix/test/outflows.csv -> ecospold2matrix/test_data/outflows.csv
	renommé :         ecospold2matrix/test/products.csv -> ecospold2matrix/test_data/products.csv
  • Loading branch information
majeau-bettez committed Jan 26, 2017
1 parent 8590fc2 commit 6ded1e9
Show file tree
Hide file tree
Showing 23 changed files with 39 additions and 26 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Compiled python modules.
*.pyc

# Setuptools distribution folder.
/dist/

# Python egg metadata, regenerated from source files by setuptools.
/*.egg-info
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include ecospold2matrix/parameters/*
include ecospold2matrix/test_data/*
include ecospold2matrix/*sql
4 changes: 0 additions & 4 deletions ecospold2matrix/ecospold2matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@
"""
try:
import IPython
except:
pass
import os
import glob
import io
Expand Down
3 changes: 0 additions & 3 deletions ecospold2matrix/test/STR.csv

This file was deleted.

File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions ecospold2matrix/test_data/STR.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
|id|name|unit|cas|comp|subcomp
494eb62d-3e16-4a81-b344-6d6dfd9fd4e2|494eb62d-3e16-4a81-b344-6d6dfd9fd4e2|Methane, bromochlorodifluoro-, Halon 1211|kg|000353-59-3|air|non-urban air or from high stacks
70ef743b-3ed5-4a6d-b192-fb6d62378555|70ef743b-3ed5-4a6d-b192-fb6d62378555|Methane, fossil|kg|000074-82-8|air|non-urban air or from high stacks
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
28 changes: 14 additions & 14 deletions ecospold2matrix/test_ecospold2matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TestE2M(unittest.TestCase):


def setUp(self):
self.sysdir='./test/'
self.sysdir='./test_data/'
self.name = 'test'

prod = ['foo', 'waste']
Expand Down Expand Up @@ -154,7 +154,7 @@ def assert_same_but_roworder(self, x, y, cols=None):
def test_extract_products(self):

# Load test value from csv file
products0 = pd.DataFrame.from_csv('./test/products.csv', sep='|')
products0 = pd.DataFrame.from_csv('./test_data/products.csv', sep='|')
products0.rename(columns={'productId.1':'productId'}, inplace=True)

# build product list
Expand All @@ -166,7 +166,7 @@ def test_extract_products(self):
def test_extract_activities(self):

# Load test values from csv file
activities0 = pd.read_csv('./test/activities.csv', sep='|', index_col=0)
activities0 = pd.read_csv('./test_data/activities.csv', sep='|', index_col=0)

# build activity list
parser = e2m.Ecospold2Matrix(self.sysdir, self.name)
Expand All @@ -177,16 +177,16 @@ def test_extract_activities(self):
def test_build_STR(self):

# Read test values from csv file
STR0 = pd.read_csv('./test/STR.csv', sep='|', index_col=0)

STR0 = pd.read_csv('./test_data/STR.csv', sep='|', index_col=0)
STR0.index.name = 'id'
parser = e2m.Ecospold2Matrix(self.sysdir, self.name)
parser.build_STR()

pdt.assert_frame_equal(STR0, parser.STR)

def test_build_PRO(self):
# Read test values from csv file
PRO0 = pd.read_table('./test/PRO.csv', sep='|', index_col=0)
PRO0 = pd.read_table('./test_data/PRO.csv', sep='|', index_col=0)

parser = e2m.Ecospold2Matrix(self.sysdir, self.name)
parser.build_PRO()
Expand All @@ -198,9 +198,9 @@ def test_build_PRO(self):
def test_extract_flows(self):

# Read test values from csv file
inflows0 = pd.read_table('./test/inflows.csv', sep='|', index_col=0)
outflows0 = pd.read_table('./test/outflows.csv', sep='|', index_col=0)
elementary_flows0 = pd.read_table('./test/elementary_flows.csv',
inflows0 = pd.read_table('./test_data/inflows.csv', sep='|', index_col=0)
outflows0 = pd.read_table('./test_data/outflows.csv', sep='|', index_col=0)
elementary_flows0 = pd.read_table('./test_data/elementary_flows.csv',
sep='|', index_col=0)

parser = e2m.Ecospold2Matrix(self.sysdir, self.name)
Expand All @@ -214,15 +214,15 @@ def test_extract_flows(self):
def test_complement_labels(self):

# Read test values from csv file
PRO0 = pd.DataFrame.from_csv('./test/PRO_full.csv', sep='|')
PRO0 = pd.DataFrame.from_csv('./test_data/PRO_full.csv', sep='|')

parser = e2m.Ecospold2Matrix(self.sysdir, self.name)
products0 = pd.DataFrame.from_csv('./test/products.csv', sep='|')
products0 = pd.DataFrame.from_csv('./test_data/products.csv', sep='|')
parser.products = products0.rename(columns={'productId.1':'productId'})
parser.activities = pd.read_csv('./test/activities.csv',
parser.activities = pd.read_csv('./test_data/activities.csv',
sep='|', index_col=0)
parser.STR = pd.read_csv('./test/STR.csv', sep='|', index_col=0)
parser.PRO = pd.read_table('./test/PRO.csv', sep='|', index_col=0)
parser.STR = pd.read_csv('./test_data/STR.csv', sep='|', index_col=0)
parser.PRO = pd.read_table('./test_data/PRO.csv', sep='|', index_col=0)

parser.complement_labels()

Expand Down
18 changes: 13 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,22 @@
packages=['ecospold2matrix', ],
version='0.1.0',
author='Guillaume Majeau-Bettez',
author_email='guillaume.majeau-bettez@ntnu.no',
license=open('LICENSE.txt').read(),
description="Class for recasting Ecospold2 LCA dataset into Leontief matrix representations or Supply and Use Tables",
author_email="guillaume.majeau-bettez@ntnu.no",
long_description=open('README.md').read(),
url='https://github.com/majeau-bettez/ecospold2matrix',
install_requires=['numpy >= 1.11.0', 'lxml', 'nose >= 1.3.7', 'pandas >= 0.18.1', 'python-dateutil >= 2.5.3',
'scipy >= 0.17.0', 'six >= 1.10.0', 'xlrd >= 0.9.4', 'xlwt >= 1.0.0'],
data_files=[('parameters', [cas_conflicts.csv,
custom_factors.csv,
synonyms.csv])],
install_requires=['numpy >= 1.11.0',
'lxml',
'nose >= 1.3.7',
'pandas >= 0.18.0',
'python-dateutil >= 2.5.3',
'scipy >= 0.17.0',
'six >= 1.10.0',
'xlrd >= 0.9.4',
'xlwt >= 1.0.0'],
data_files=[('parameters', ['cas_conflicts.csv',
'custom_factors.csv',
'synonyms.csv'])],
)

0 comments on commit 6ded1e9

Please sign in to comment.