Python Scraping Data From the Web Additional Scraping Tasks Using Scrapers for Site Testing

AttributeError occurs only in Jupyter

Hi. Any idea what causes this to work fine in my console but fail in Jupyter Notebooks?

my code

from urllib.request import urlopen
from bs4 import BeautifulSoup

import unittest

class TestHorseLand(unittest.TestCase):
    soup = None

    def setUpClass():
        url = ''

        TestHorseLand.soup = BeautifulSoup(urlopen(url), 'html.parser')

        def test_header1(self):
            header1 = TestHorseLand.soup.find('h1').get_text()
            self.assertEqual('Horse Land', header1)

if __name__ == '__main__':

Error I see

ERROR: /run/user/1001/jupyter/kernel-f40f8998-b6f3-4dc3-b1f6-c533c177540e (unittest.loader._FailedTest)
AttributeError: module '__main__' has no attribute '/run/user/1001/jupyter/kernel-f40f8998-b6f3-4dc3-b1f6-c533c177540e'

Ran 1 test in 0.002s

FAILED (errors=1)
An exception has occurred, use %tb to see the full traceback.

SystemExit: True