class XBRLExtractorTest(unittest.TestCase):
    def setUp(self):
        self.baseUrl = 'https://www.sec.gov/Archives/edgar/'
        self.parser = FileParser()
        self.xe = XBRLExtractor()

    def test_xbrl1(self):
        url = self.baseUrl + 'data/1005286/0001437749-15-017917.txt'
        text, code = self.parser._getFile(url)
        result, debtDisclosure = self.xe.processText(text)
        self.assertTrue(result)
        self.assertIsInstance(result[0], DebtLineItem)

    def test_xbrl2(self):
        url = self.baseUrl + 'data/815097/0000815097-16-000040.txt'
        text, code = self.parser._getFile(url)
        result, debtDisclosure = self.xe.processText(text)
        self.assertTrue(result)
        self.assertIsInstance(result[0], DebtLineItem)

    def test_xbrl3(self):
        url = self.baseUrl + 'data/63754/0000063754-16-000089.txt'
        text, code = self.parser._getFile(url)
        result, debtDisclosure = self.xe.processText(text)
        self.assertTrue(result)
        self.assertIsInstance(result[0], DebtLineItem)

    def test_longXbrl(self):
        url = self.baseUrl + 'data/1393612/0001193125-11-091525.txt'
        text, code = self.parser._getFile(url)
        result, debtDisclosure = self.xe.processText(text)
        self.assertTrue(result)
        self.assertIsInstance(result[0], DebtLineItem)
class HTMLExtractorTest(unittest.TestCase):
    def setUp(self):
        self.baseUrl = 'https://www.sec.gov/Archives/edgar/'
        self.parser = FileParser()
        self.he = HTMLExtractor()

    def test_htmlWithTables(self):
        url = self.baseUrl + 'data/1012956/0001193125-03-015316.txt'
        text, code = self.parser._getFile(url)
        result = self.he.processText(text)
        self.assertTrue(result)
        self.assertIsInstance(result[0], DebtLineItem)

    def test_htmlWithTables2(self):
        url = self.baseUrl + 'data/225261/0001047469-03-023135.txt'
        text, code = self.parser._getFile(url)
        result = self.he.processText(text)
        self.assertTrue(result)
        self.assertIsInstance(result[0], DebtLineItem)

    def test_htmlWithTables3(self):
        url = self.baseUrl + 'data/1368055/0001140361-10-002064.txt'
        text, code = self.parser._getFile(url)
        result = self.he.processText(text)
        self.assertTrue(result)
        self.assertIsInstance(result[0], DebtLineItem)

    def test_htmlWOTables(self):
        url = self.baseUrl + 'data/915337/0001002334-10-000006.txt'
        text, code = self.parser._getFile(url)
        result = self.he.processText(text)
        self.assertTrue(result)
        self.assertIsInstance(result[0], DebtLineItem)

    def test_htmlWOTables2(self):
        url = self.baseUrl + 'data/1439981/0001137050-10-000003.txt'
        text, code = self.parser._getFile(url)
        result = self.he.processText(text)
        self.assertTrue(result)
        self.assertIsInstance(result[0], DebtLineItem)

    def test_htmlWithZeros(self):
        url = self.baseUrl + 'data/1468679/0001271008-11-000006.txt'
        text, code = self.parser._getFile(url)
        result = self.he.processText(text)
        self.assertTrue(result)
        self.assertIsInstance(result[0], DebtLineItem)