Skip to content

Tests for distributions.py#324

Merged
mmcky merged 1 commit intoQuantEcon:masterfrom
QBatista:test-distributions
Aug 16, 2017
Merged

Tests for distributions.py#324
mmcky merged 1 commit intoQuantEcon:masterfrom
QBatista:test-distributions

Conversation

@QBatista
Copy link
Copy Markdown
Member

Adds tests for distributions.py

Close #301

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.4%) to 92.549% when pulling 1d873ae on QBatista:test-distributions into 64d964c on QuantEcon:master.

Comment thread quantecon/tests/test_distributions.py Outdated
def test_init(self):
assert_allclose(self.n, self.test_obj.n)
assert_allclose(self.a, self.test_obj.a)
assert_allclose(self.b, self.test_obj.b)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should have told you this, but for equality between scalars, you can use eq_ from nose.tools:

from nose.tools import eq_

eq_(self.test_obj.n, self.n)

Comment thread quantecon/tests/test_distributions.py Outdated
self.b = 1
self.test_obj = BetaBinomial(self.n, self.a, self.b)
for prob in self.test_obj.pdf():
assert_allclose(0.1, prob)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this you can use assert_allclose:

assert_allclose(test_obj.pdf(), np.full(n+1, 1/(n+1)))

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.4%) to 92.551% when pulling e18d9b2 on QBatista:test-distributions into 64d964c on QuantEcon:master.

@QBatista QBatista force-pushed the test-distributions branch from e18d9b2 to 9979467 Compare August 16, 2017 01:24
@QBatista QBatista force-pushed the test-distributions branch from 9979467 to 4ec9e93 Compare August 16, 2017 01:25
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.4%) to 92.549% when pulling 4ec9e93 on QBatista:test-distributions into 64d964c on QuantEcon:master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.4%) to 92.549% when pulling 4ec9e93 on QBatista:test-distributions into 64d964c on QuantEcon:master.

@mmcky mmcky merged commit 7808f02 into QuantEcon:master Aug 16, 2017
@mmcky
Copy link
Copy Markdown
Contributor

mmcky commented Aug 16, 2017

thanks @oyamad for approval. Thanks @QBatista for the contribution.

@QBatista QBatista deleted the test-distributions branch September 23, 2017 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants