from unittest import TestCase
from dosagelib import scraper


class ScraperTester(TestCase):
    """Test scraper module functions."""

    def test_get_scraperclasses(self):
        for scraperclass in scraper.get_scraperclasses():
            scraperclass()
            scraperclass(indexes=["bla"])

    def test_find_scraperclasses_single(self):
        result = scraper.find_scraperclasses("CalvinAndHobbes")
        self.assertEqual(len(result), 1)

    def test_find_scraperclasses_multi(self):
        result = scraper.find_scraperclasses("a", multiple_allowed=True)
        self.assertTrue(len(result) > 1)

    def test_find_scraperclasses_error(self):
        self.assertRaises(ValueError, scraper.find_scraperclasses, "")

from unittest import TestCase
from dosagelib import scraper


class ScraperTester(TestCase):
    """Test scraper module functions."""

    def test_get_scraperclasses(self):
        for scraperclass in scraper.get_scraperclasses():
            scraperobj = scraperclass()
            scraperobj = scraperclass(indexes=["bla"])
            self.assertTrue(scraperobj.url,
                "missing url in %s" % scraperobj.getName())

    def test_find_scraperclasses_single(self):
        result = scraper.find_scraperclasses("CalvinAndHobbes")
        self.assertEqual(len(result), 1)

    def test_find_scraperclasses_multi(self):
        result = scraper.find_scraperclasses("a", multiple_allowed=True)
        self.assertTrue(len(result) > 1)

    def test_find_scraperclasses_error(self):
        self.assertRaises(ValueError, scraper.find_scraperclasses, "")

Test for URL in every scraper.
Test for URL in every scraper.

  from unittest import TestCase
  from dosagelib import scraper
  
  
  class ScraperTester(TestCase):
      """Test scraper module functions."""
  
      def test_get_scraperclasses(self):
          for scraperclass in scraper.get_scraperclasses():
-             scraperclass()
+             scraperobj = scraperclass()
-             scraperclass(indexes=["bla"])
+             scraperobj = scraperclass(indexes=["bla"])
+             self.assertTrue(scraperobj.url,
+                 "missing url in %s" % scraperobj.getName())
  
      def test_find_scraperclasses_single(self):
          result = scraper.find_scraperclasses("CalvinAndHobbes")
          self.assertEqual(len(result), 1)
  
      def test_find_scraperclasses_multi(self):
          result = scraper.find_scraperclasses("a", multiple_allowed=True)
          self.assertTrue(len(result) > 1)
  
      def test_find_scraperclasses_error(self):
          self.assertRaises(ValueError, scraper.find_scraperclasses, "")
  
Test for URL in every scraper.
## Code Before:
from unittest import TestCase
from dosagelib import scraper


class ScraperTester(TestCase):
    """Test scraper module functions."""

    def test_get_scraperclasses(self):
        for scraperclass in scraper.get_scraperclasses():
            scraperclass()
            scraperclass(indexes=["bla"])

    def test_find_scraperclasses_single(self):
        result = scraper.find_scraperclasses("CalvinAndHobbes")
        self.assertEqual(len(result), 1)

    def test_find_scraperclasses_multi(self):
        result = scraper.find_scraperclasses("a", multiple_allowed=True)
        self.assertTrue(len(result) > 1)

    def test_find_scraperclasses_error(self):
        self.assertRaises(ValueError, scraper.find_scraperclasses, "")

## Instruction:
Test for URL in every scraper.
## Code After:
from unittest import TestCase
from dosagelib import scraper


class ScraperTester(TestCase):
    """Test scraper module functions."""

    def test_get_scraperclasses(self):
        for scraperclass in scraper.get_scraperclasses():
            scraperobj = scraperclass()
            scraperobj = scraperclass(indexes=["bla"])
            self.assertTrue(scraperobj.url,
                "missing url in %s" % scraperobj.getName())

    def test_find_scraperclasses_single(self):
        result = scraper.find_scraperclasses("CalvinAndHobbes")
        self.assertEqual(len(result), 1)

    def test_find_scraperclasses_multi(self):
        result = scraper.find_scraperclasses("a", multiple_allowed=True)
        self.assertTrue(len(result) > 1)

    def test_find_scraperclasses_error(self):
        self.assertRaises(ValueError, scraper.find_scraperclasses, "")
