Improve assert readability (#6132)

This commit is contained in:
Jeesang Kim 2023-11-03 17:24:25 +09:00 committed by GitHub
parent 593bfd895a
commit dda6feb935
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 12 deletions

View File

@ -235,20 +235,20 @@ class Base:
url2 = "http://evenmorestuff.com/uglystuff/index"
lx = self.extractor_cls(allow=(r"stuff1",))
self.assertEqual(lx.matches(url1), True)
self.assertEqual(lx.matches(url2), False)
self.assertTrue(lx.matches(url1))
self.assertFalse(lx.matches(url2))
lx = self.extractor_cls(deny=(r"uglystuff",))
self.assertEqual(lx.matches(url1), True)
self.assertEqual(lx.matches(url2), False)
self.assertTrue(lx.matches(url1))
self.assertFalse(lx.matches(url2))
lx = self.extractor_cls(allow_domains=("evenmorestuff.com",))
self.assertEqual(lx.matches(url1), False)
self.assertEqual(lx.matches(url2), True)
self.assertFalse(lx.matches(url1))
self.assertTrue(lx.matches(url2))
lx = self.extractor_cls(deny_domains=("lotsofstuff.com",))
self.assertEqual(lx.matches(url1), False)
self.assertEqual(lx.matches(url2), True)
self.assertFalse(lx.matches(url1))
self.assertTrue(lx.matches(url2))
lx = self.extractor_cls(
allow=["blah1"],
@ -256,10 +256,10 @@ class Base:
allow_domains=["blah1.com"],
deny_domains=["blah2.com"],
)
self.assertEqual(lx.matches("http://blah1.com/blah1"), True)
self.assertEqual(lx.matches("http://blah1.com/blah2"), False)
self.assertEqual(lx.matches("http://blah2.com/blah1"), False)
self.assertEqual(lx.matches("http://blah2.com/blah2"), False)
self.assertTrue(lx.matches("http://blah1.com/blah1"))
self.assertFalse(lx.matches("http://blah1.com/blah2"))
self.assertFalse(lx.matches("http://blah2.com/blah1"))
self.assertFalse(lx.matches("http://blah2.com/blah2"))
def test_restrict_xpaths(self):
lx = self.extractor_cls(restrict_xpaths=('//div[@id="subwrapper"]',))