-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructured the codebase to add tests
- Loading branch information
1 parent
bf1aef3
commit f99be01
Showing
10 changed files
with
30 additions
and
54 deletions.
There are no files selected for viewing
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,23 +1,25 @@ | ||
from setuptools import setup, find_packages | ||
from setuptools.commnad.test import test as TestCommand | ||
from setuptools.command.test import test as TestCommand | ||
import io | ||
import codecs | ||
import os | ||
import sys | ||
import performanceanalytics | ||
|
||
|
||
here = os.path.abspath(os.path.dirname(__file__)) | ||
|
||
|
||
def read(*filenames, **kwargs): | ||
encoding = kwargs.get('encoding','utf-8') | ||
sep = kwargs.get('sep','\n') | ||
encoding = kwargs.get('encoding', 'utf-8') | ||
sep = kwargs.get('sep', '\n') | ||
buf = [] | ||
for filename in filenames: | ||
with io.open(filename, encoding=encoding) as f: | ||
buf.append(f.read()) | ||
return sep.join(buf) | ||
|
||
long_description = read('README.txt','CHANGES.txt') | ||
long_description = read('README.md', 'CHANGES.txt') | ||
|
||
|
||
class PyTest(TestCommand): | ||
def finalize_options(self): | ||
|
@@ -32,20 +34,20 @@ def run_tests(self): | |
|
||
setup( | ||
name='PerformanceAnalytics', | ||
version= performanceanalytics.__version__, | ||
version= 0.1, | ||
url='http://github.com/zsljulius/performanceanalytics', | ||
license='Apache Software license', | ||
author='Shenglan Zhang', | ||
tests_require=['pytest'], | ||
install_requires=['numpy','Pandas'], | ||
cmdclass={'test':PyTest} | ||
author_email={'[email protected]'} | ||
description='A python implementation of the PerformanceAnalytics in R' | ||
long_description = long_description | ||
packages = ["PerformanceAnalytics"] | ||
install_requires=['numpy', 'Pandas'], | ||
cmdclass={'test': PyTest}, | ||
author_email={'[email protected]'}, | ||
description='A python implementation of the PerformanceAnalytics in R', | ||
long_description = long_description, | ||
packages = ["PerformanceAnalytics"], | ||
include_package_data=True, | ||
platforms ='any' | ||
test_suite='PerformanceAnalytics.test.test_PerformanceAnalytics' | ||
platforms ='any', | ||
test_suite='PerformanceAnalytics.test.test_PerformanceAnalytics', | ||
classifiers=[ | ||
'Programming Language :: Python', | ||
'Development Status :: 4 - Beta', | ||
|
@@ -55,4 +57,4 @@ def run_tests(self): | |
extras_require ={ | ||
'testing':['pytest'] | ||
} | ||
|
||
) |
File renamed without changes.
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,13 @@ | ||
from PerformanceAnalytics import returns | ||
import pandas as pd | ||
|
||
|
||
class TestReturns: | ||
def test_rebalancing(self): | ||
weights = pd.read_csv("weights.csv", parse_dates=[0]) | ||
edhec = pd.read_csv("edhec.csv", parse_dates=[0]) | ||
edhec.index = edhec.ix[:, 0] | ||
weights.index = weights.ix[:, 0] | ||
weights = weights.ix[:, 1:] | ||
edhec = edhec.ix[:, 1:] | ||
assert len(returns.rebalancing(edhec, weights)) == 116 |
File renamed without changes.