def test_collect(self): storage = Storage(self.ROOT) path = storage.download(kind="XF", year=2018) ledger = storage.download_ledger(directory=f"{self.ROOT}/processed") self.assertGreater(len(ledger.data), 1) self.assertTrue(Path(ledger.path).exists) loaded = ledger.collect(edinet_code="E00021") self.assertGreater(len(loaded), 0)
def test_download_extracted(self): storage = Storage(self.ROOT) path = storage.download(directory=f"{self.ROOT}/rawe", kind="XE", year=2018) self.assertTrue(path.exists()) self.assertEqual(path.name, "2018") self.assertTrue(path.joinpath("documents.csv").exists()) self.assertTrue(path.joinpath("docs").exists()) self.assertGreater(len(list(path.joinpath("docs").glob("*.txt"))), 1)
def test_parse(self): storage = Storage(self.ROOT) path = self._download(kind="F") path = storage.parse("company.history") self.assertTrue(path.exists()) self.assertTrue(path.joinpath("2018").exists()) self.assertTrue(path.joinpath("2018/documents.csv").exists()) self.assertGreater( len(list(path.joinpath("2018/docs").glob("*company_history.txt"))), 0) path = storage.parse("business.risks", sec_code="1376") with path.joinpath("2018/documents.csv").open(encoding="utf-8") as f: self.assertEquals(len(f.readlines()), 2) self.assertEquals( len(list(path.joinpath("2018/docs").glob("*business_risks.txt"))), 1)
def __init__(self, version="v1.0"): self._storage = Storage(version=version)
def _download(self, kind="F"): storage = Storage(self.ROOT) path = storage.download(kind="X" + kind, year=2018) return path
def test_download_ledger(self): storage = Storage(self.ROOT) ledger = storage.download_ledger(directory=f"{self.ROOT}/processed") self.assertGreater(len(ledger.data), 1) self.assertTrue(Path(ledger.path).exists)
def __init__(self): self._storage = Storage()