Skip to content

Commit

Permalink
TEST: Fix test_discrete_rv (#412)
Browse files Browse the repository at this point in the history
  • Loading branch information
oyamad authored and mmcky committed Jun 1, 2018
1 parent 5fae02f commit 8657c91
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions quantecon/tests/test_discrete_rv.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
Tests for discrete_rv.py
"""
from __future__ import division
from collections import Counter
import unittest
import numpy as np
from numpy.testing import assert_allclose
from nose.plugins.attrib import attr
import pandas as pd
from quantecon import DiscreteRV


Expand Down Expand Up @@ -49,9 +46,9 @@ def test_Q_end_1(self):
def test_draw_lln(self):
"discrete_rv: lln satisfied?"
draws = self.drv.draw(1000000)
counts = pd.Series(Counter(draws))
counts = (counts / counts.sum()).values
assert max(np.abs(counts - self.drv.q)) < 1e-2
bins = np.arange(self.drv.q.size+1)
freqs, _ = np.histogram(draws, bins=bins, density=True)
assert_allclose(freqs, self.drv.q, atol=1e-2)

def test_draw_with_seed(self):
x = np.array([0.03326189, 0.60713005, 0.84514831, 0.28493183,
Expand Down

0 comments on commit 8657c91

Please sign in to comment.