Skip to content

Commit

Permalink
TST: Add egarch and rm2006 tests
Browse files Browse the repository at this point in the history
Add formal tests for egarch and rm2006 models
Clean up test_array
Remove unnecessary smoke tests
  • Loading branch information
bashtage committed Dec 29, 2016
1 parent 51a187c commit 610d9e8
Show file tree
Hide file tree
Showing 5 changed files with 413 additions and 77 deletions.
32 changes: 14 additions & 18 deletions arch/bootstrap/tests/test_bootstrap.py
Expand Up @@ -234,24 +234,6 @@ def func(y):
direct_cov = errors.T.dot(errors) / num_bootstrap
assert_allclose(cov, direct_cov)

def test_smoke(self):
# TODO: Upgrade to meaningful test
num_bootstrap = 20

def func(y):
return y.mean(axis=0)

bs = StationaryBootstrap(13, self.y)
bs.cov(func, reps=num_bootstrap)
bs = MovingBlockBootstrap(13, self.y)
bs.cov(func, reps=num_bootstrap)
bs = CircularBlockBootstrap(13, self.y)
bs.cov(func, reps=num_bootstrap)
bs = MovingBlockBootstrap(10, self.y)
bs.cov(func, reps=num_bootstrap)
bs = CircularBlockBootstrap(10, self.y)
bs.cov(func, reps=num_bootstrap)

def test_conf_int_basic(self):
num_bootstrap = 200
bs = IIDBootstrap(self.x)
Expand Down Expand Up @@ -688,6 +670,20 @@ def test_str(self):
' <strong>ID</strong>: ' + hex(id(bs)) + ')'
assert_equal(bs._repr_html(), expected)

bs = MovingBlockBootstrap(block_size=20, y=self.y_series,
x=self.x_df)
expected = 'Moving Block Bootstrap(block size: 20, no. pos. ' \
'inputs: 0, no. keyword inputs: 2)'
assert_equal(str(bs), expected)
expected = expected[:-1] + ', ID: ' + hex(id(bs)) + ')'
assert_equal(bs.__repr__(), expected)
expected = '<strong>Moving Block Bootstrap</strong>' + \
'(<strong>block size</strong>: 20, ' \
+ '<strong>no. pos. inputs</strong>: 0, ' + \
'<strong>no. keyword inputs</strong>: 2,' + \
' <strong>ID</strong>: ' + hex(id(bs)) + ')'
assert_equal(bs._repr_html(), expected)

@pytest.mark.skipif(not HAS_EXTENSION, reason='Extension not built.')
def test_samplers(self):
"""
Expand Down
5 changes: 1 addition & 4 deletions arch/bootstrap/tests/test_multiple_comparrison.py
Expand Up @@ -382,10 +382,7 @@ def max_step(losses, indices):
direct.index.name = 'Model index'
assert_frame_equal(mcs.pvalues.iloc[:m], direct)

def test_smoke(self):
# TODO: Upgrade to meaningful test
mcs = MCS(self.losses, 0.05, reps=100, block_size=10, method='max')
mcs.compute()
def test_output_types(self):
mcs = MCS(self.losses_df, 0.05, reps=100, block_size=10, method='r')
mcs.compute()
assert_equal(type(mcs.included), list)
Expand Down

0 comments on commit 610d9e8

Please sign in to comment.