Commit b5418fb8 authored by Dr.李's avatar Dr.李

TEST: fixed bad test cases

parent 889f2a47
...@@ -23,14 +23,14 @@ class TestRank(unittest.TestCase): ...@@ -23,14 +23,14 @@ class TestRank(unittest.TestCase):
sorted_array = np.zeros_like(self.x) sorted_array = np.zeros_like(self.x)
for i in range(self.x.shape[0]): for i in range(self.x.shape[0]):
for j in range(self.x.shape[1]): for j in range(self.x.shape[1]):
sorted_array[data_rank[i, j], j] = self.x[i, j] sorted_array[int(data_rank[i, j]), j] = self.x[i, j]
arr_diff = np.diff(sorted_array, axis=0) arr_diff = np.diff(sorted_array, axis=0)
np.testing.assert_array_less(0, arr_diff) np.testing.assert_array_less(0, arr_diff)
def test_rank_with_groups(self): def test_rank_with_groups(self):
data = pd.DataFrame(data={'raw': self.x.tolist()}, index=self.groups) data = pd.DataFrame(data={'raw': self.x.tolist()}, index=self.groups)
data['rank'] = rank(data['raw'], groups=data.index) data['rank'] = rank(data['raw'].values, groups=data.index)
groups = dict(list(data['rank'].groupby(level=0))) groups = dict(list(data['rank'].groupby(level=0)))
ret = [] ret = []
for index in range(10): for index in range(10):
......
# -*- coding: utf-8 -*-
"""
Created on 2018-2-7
@author: cheng.li
"""
import unittest
from alphamind.portfolio.allocations import Asset
from alphamind.portfolio.allocations import Portfolio
from alphamind.portfolio.allocations import Positions
from alphamind.portfolio.allocations import Execution
class TestAllocation(unittest.TestCase):
pass
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment