Ezio Melotti added the comment: 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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17066> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com