class TestSessionFactory_1_1:
    def setup(self):
        self.connection_string = "sqlite:///:memory:"
        self.session_factory = SessionFactory(self.connection_string,
                                              echo=True)

    def test_create_session_factory(self):
        assert repr(
            self.session_factory
        ) == "<SessionFactory('Engine(%s)')>" % self.connection_string
        assert self.session_factory.Session != None

    def test_get_session(self):
        session = self.session_factory.get_session()
        assert 'sqlalchemy.orm.session.Session' in repr(session)
class TestPandasMemoryDB_1_1:
    """
    Test to Load up a series from a dataframe and load it into an in memory database
    """
    def setup(self):
        self.connection_string = "sqlite:///:memory:"
        self.session_factory = SessionFactory(self.connection_string,
                                              echo=False)
        self.session = self.session_factory.get_session()

        self.series_service = SeriesService(
            connection_string=self.connection_string)
        engine = self.session_factory.engine
        test_util.build_db(engine)

    def test_build_series(self):
        dvs = 100
        self.series = test_util.add_series_bulk_data(self.session,
                                                     dvs_size=dvs)
        assert self.series
        assert len(self.series.data_values) == dvs