PageRenderTime 45ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/ramp/tests/test_store.py

https://github.com/psattige/ramp
Python | 28 lines | 20 code | 8 blank | 0 comment | 1 complexity | 3da6bec677d4044ca62d15dc8821220a MD5 | raw file
  1. import sys
  2. sys.path.append('../..')
  3. import tempfile
  4. import unittest
  5. import pandas as pd
  6. from pandas import DataFrame
  7. from pandas.util.testing import assert_almost_equal
  8. from ramp.features import F, FittedFeature
  9. from ramp.result import Result
  10. from ramp.store import *
  11. class TestStore(unittest.TestCase):
  12. def setUp(self):
  13. self.tmp = tempfile.mkdtemp()
  14. def test_storable(self):
  15. f = FittedFeature(F('a'), pd.Index([]), pd.Index([]))
  16. f.to_pickle(self.tmp + 'tst')
  17. f2 = FittedFeature.from_pickle(self.tmp + 'tst')
  18. self.assertEqual(f2.prep_n, f.prep_n)
  19. if __name__ == '__main__':
  20. unittest.main()