BUG: issues/2331, change to assert_almost_equal and style improvement