Message183895
Do you think doing something like:
class BaseRobotTest:
def setUp(self):
lines = io.StringIO(robots_txt).readlines()
self.parser = urllib.robotparser.RobotFileParser()
parser.parse(lines)
def test_good(self):
for url in good:
self.assertTrue(self.parser.can_fetch(...))
def test_bad(self):
for url in bad:
self.assertFalse(self.parser.can_fetch(...))
class RobotTestX(BaseRobotTest, unittest.TestCase):
doc = "..."
good = [...]
bad = [...]
...
would be a better approach?
On one hand is a bit more verbose and doesn't create a separate test for each URL (I don't think that's important though), but on the other hand it gets rid of lot of magic and makes the test more understandable. |
|
Date |
User |
Action |
Args |
2013-03-10 20:24:20 | ezio.melotti | set | recipients:
+ ezio.melotti, brett.cannon, zach.ware |
2013-03-10 20:24:20 | ezio.melotti | set | messageid: <1362947060.8.0.241866993652.issue17066@psf.upfronthosting.co.za> |
2013-03-10 20:24:20 | ezio.melotti | link | issue17066 messages |
2013-03-10 20:24:20 | ezio.melotti | create | |
|