浏览代码

Change assertTrue(isinstance()) by optimal assert

Some of tests use different method of
assertTrue(isinstance(A, B)) or assertEqual(type(A), B).
The correct way is to use assertIsInstance(A, B) provided
by testtools

Change-Id: Ib8dec9d44ce66b1b7ff1486a234fae73d29f23ff
tags/1.2.1
gecong1973 3 年前
父节点
当前提交
52d9c52723
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. +2
    -2
      sitemap/test/generator/test_pipelines.py

+ 2
- 2
sitemap/test/generator/test_pipelines.py 查看文件

@@ -37,7 +37,7 @@ class TestIgnoreDuplicateUrls(unittest.TestCase):
self.ignore_urls = pipelines.IgnoreDuplicateUrls()

def test_set_is_set_at_init(self):
self.assertTrue(isinstance(self.ignore_urls.processed, set))
self.assertIsInstance(self.ignore_urls.processed, set)

def test_set_is_empty_at_init(self):
self.assertEqual(len(self.ignore_urls.processed), 0)
@@ -72,7 +72,7 @@ class TestExportSitemap(unittest.TestCase):
self.spider = mock.MagicMock()

def test_variables_set_at_init(self):
self.assertTrue(isinstance(self.export_sitemap.files, dict))
self.assertIsInstance(self.export_sitemap.files, dict)
self.assertTrue(self.export_sitemap.exporter is None)

def test_spider_opened_calls_open(self):


正在加载...
取消
保存