相关疑难解决方法(0)

Python 3.3:使用nose.tools.assert_equals时的DeprecationWarning

我正在使用nosetest工具来断言python unittest:

...
from nose.tools import assert_equals, assert_almost_equal

class TestPolycircles(unittest.TestCase):

    def setUp(self):
        self.latitude = 32.074322
        self.longitude = 34.792081
        self.radius_meters = 100
        self.number_of_vertices = 36
        self.vertices = polycircles.circle(latitude=self.latitude,
                                           longitude=self.longitude,
                                           radius=self.radius_meters,
                                           number_of_vertices=self.number_of_vertices)

    def test_number_of_vertices(self):
        """Asserts that the number of vertices in the approximation polygon
        matches the input."""
        assert_equals(len(self.vertices), self.number_of_vertices)

    ...
Run Code Online (Sandbox Code Playgroud)

当我跑步时python setup.py test,我得到一个弃用警告:

...
Asserts that the number of vertices in the approximation polygon ...
/Users/adamatan/personal/polycircles/polycircles/test/test_polycircles.py:22:    
DeprecationWarning: Please use assertEqual instead.
  assert_equals(len(self.vertices), self.number_of_vertices)
ok
...
Run Code Online (Sandbox Code Playgroud)

assertEqual在鼻子工具中找不到任何东西.这个警告来自哪里,我该如何解决?

python nose deprecated python-3.3 python-unittest

3
推荐指数
1
解决办法
1930
查看次数

标签 统计

deprecated ×1

nose ×1

python ×1

python-3.3 ×1

python-unittest ×1