def test_articles_to_jsonl(self): """Serialize pubmedarticles objects into jsonl file.""" articles: [PubMedArticle] = ArticleSetParser.extract_articles( self.SAMPLE_ARTICLE_SET1_PATH) target_file_name = "test_articles.jsonl" target_path = os.path.join(get_test_output_path(), target_file_name) ArticleSetParser.articles_to_jsonl(articles, target_path)
def test_serialize_to_pipe_delimited(self): """Serialize pubmedarticles to csv file.""" articles: [PubMedArticle] = ArticleSetParser.extract_articles( self.SAMPLE_ARTICLE_SET1_PATH) target_file_name = "test_articles.csv" target_path = os.path.join(get_test_output_path(), target_file_name) ArticleSetParser.articles_to_pipe(articles, target_path)
"""Pytest module to test Google BigQuery Repository.""" import os import pytest import tests.testdata as td import geniepy.datamgmt.repositories as dr from geniepy.datamgmt.tables import PUBMED_PROPTY, CTD_PROPTY, CLSFR_PROPTY from geniepy.errors import DaoError from tests import get_test_output_path from tests.resources.mock import TEST_CHUNKSIZE # Name of credential file (assumed to be in tests/tests_output dir) CREDENTIALS_FILE = "genie_credentials.json" CREDPATH = os.path.join(get_test_output_path(), CREDENTIALS_FILE) # Google BigQuery Project Name PROJNAME = "genie-275215" DATASET = "test" VALID_DF = td.PUBMED_VALID_DF INVALID_SCHEMA = td.PUBMED_INVALID_SCHEMA @pytest.mark.slow_integration_test class TestGbqRepository: """Test db.pubmed_repository on Google BigQuery.""" pubmed_repo: dr.BaseRepository = None ctd_repo: dr.BaseRepository = None clsfr_repo: dr.BaseRepository = None @classmethod def setup_class(cls):