|
6 | 6 |
|
7 | 7 | """
|
8 | 8 | from __future__ import division
|
| 9 | +import sys |
9 | 10 | import unittest
|
10 |
| -from nose.plugins.attrib import attr |
| 11 | +from nose.plugins.skip import SkipTest |
11 | 12 | from quantecon.models import JvWorker
|
12 | 13 | from quantecon import compute_fixed_point
|
13 | 14 | from quantecon.tests import get_h5_data_file, write_array, max_abs_diff
|
|
18 | 19 | beta = 0.96
|
19 | 20 | grid_size = 50
|
20 | 21 |
|
| 22 | +if sys.version_info[0] == 2: |
| 23 | + v_nm = "V" |
| 24 | +else: # python 3 |
| 25 | + raise SkipTest("Python 3 tests aren't ready.") |
| 26 | + v_nm = "V_py3" |
| 27 | + |
21 | 28 |
|
22 | 29 | def _new_solution(jv, f, grp):
|
23 | 30 | "gets new solution and updates data file"
|
24 | 31 | V = _solve_via_vfi(jv)
|
25 |
| - write_array(f, grp, V, "V") |
| 32 | + write_array(f, grp, V, v_nm) |
26 | 33 |
|
27 | 34 | return V
|
28 | 35 |
|
@@ -59,7 +66,10 @@ def _get_vf_guess(jv, force_new=False):
|
59 | 66 | # existing solutions
|
60 | 67 | try:
|
61 | 68 | # Try reading vfi
|
62 |
| - V = jv_group.V[:] |
| 69 | + if sys.version_info[0] == 2: |
| 70 | + V = jv_group.V[:] |
| 71 | + else: # python 3 |
| 72 | + V = jv_group.V_py3[:] |
63 | 73 |
|
64 | 74 | except:
|
65 | 75 | # doesn't exist. Let's create it
|
@@ -101,9 +111,3 @@ def test_bellman_sol_fixed_point(self):
|
101 | 111 | "jv: solution to bellman is fixed point"
|
102 | 112 | new_V = self.jv.bellman_operator(self.V)
|
103 | 113 | self.assertLessEqual(max_abs_diff(new_V, self.V), 1e-4)
|
104 |
| - |
105 |
| - @attr("slow") |
106 |
| - def test_bruteforce_bellman(self): |
107 |
| - "jv: bellman_operator bruteforce option returns fp" |
108 |
| - new_V = self.jv.bellman_operator(self.V, brute_force=True) |
109 |
| - self.assertEqual(new_V.shape, self.V.shape) |
|
0 commit comments