Browse Source

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 years ago
parent
commit
52d9c52723
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      sitemap/test/generator/test_pipelines.py

+ 2
- 2
sitemap/test/generator/test_pipelines.py View File

@@ -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):

Loading…
Cancel
Save