-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import pickle | ||
|
||
from unittest.case import TestCase | ||
|
||
from fireant import ( | ||
MySQLDatabase, | ||
PostgreSQLDatabase, | ||
RedshiftDatabase, | ||
SnowflakeDatabase, | ||
VerticaDatabase, | ||
) | ||
|
||
|
||
class DatabasePickleTests(TestCase): | ||
def test_that_database_inst_can_be_pickled(self): | ||
for db_inst in ( | ||
MySQLDatabase(), | ||
PostgreSQLDatabase(), | ||
RedshiftDatabase(), | ||
SnowflakeDatabase(), | ||
VerticaDatabase(), | ||
): | ||
with self.subTest(f'serialization {db_inst.__class__.__name__}'): | ||
dump = pickle.dumps(db_inst, pickle.HIGHEST_PROTOCOL) | ||
self.assertIsNotNone(dump, dump) | ||
|
||
with self.subTest(f'deserialization {db_inst.__class__.__name__}'): | ||
db_pickle = pickle.loads(dump) | ||
self.assertIsNotNone(db_pickle, dump) |