def test_open(self): ''' Test opening the database. :return: ''' csvdb = CsvDB('/foobar') csvdb.open() assert csvdb.list_tables() == ['test_db'] assert csvdb.is_closed() is False
def test_close(self): ''' Test closing the database. :return: ''' csvdb = CsvDB('/foobar') csvdb.open() csvdb.close() assert csvdb.is_closed() is True
def test_open(self): """ Test opening the database. :return: """ with patch("os.listdir", MagicMock(return_value=["test_db"])), patch( "gzip.open", mock_open("foo:int,bar:str")): csvdb = CsvDB("/foobar") csvdb.open() assert list(csvdb.list_tables()) == ["test_db"] assert csvdb.is_closed() is False
def test_close(self): """ Test closing the database. :return: """ with patch("os.listdir", MagicMock(return_value=["test_db"])), patch( "gzip.open", mock_open("foo:int,bar:str")): csvdb = CsvDB("/foobar") csvdb.open() csvdb.close() assert csvdb.is_closed() is True
def test_close(self): ''' Test closing the database. :return: ''' with patch("os.listdir", MagicMock(return_value=['test_db'])), \ patch("gzip.open", mock_open("foo:int,bar:str")): csvdb = CsvDB('/foobar') csvdb.open() csvdb.close() assert csvdb.is_closed() is True