mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-24 14:15:14 +02:00
[coverage] tests for coverage increase
This commit is contained in:
parent
276330d1d1
commit
6f29c4646c
4 changed files with 183 additions and 3 deletions
37
GPy/testing/cacher_tests.py
Normal file
37
GPy/testing/cacher_tests.py
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
'''
|
||||
Created on 4 Sep 2015
|
||||
|
||||
@author: maxz
|
||||
'''
|
||||
import unittest
|
||||
from GPy.util.caching import Cacher
|
||||
from pickle import PickleError
|
||||
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
def setUp(self):
|
||||
def op(x):
|
||||
return x
|
||||
self.cache = Cacher(op, 1)
|
||||
|
||||
def test_pickling(self):
|
||||
self.assertRaises(PickleError, self.cache.__getstate__)
|
||||
self.assertRaises(PickleError, self.cache.__setstate__)
|
||||
|
||||
def test_copy(self):
|
||||
tmp = self.cache.__deepcopy__()
|
||||
assert(tmp.operation is self.cache.operation)
|
||||
self.assertEqual(tmp.limit, self.cache.limit)
|
||||
|
||||
def test_reset(self):
|
||||
self.cache.reset()
|
||||
self.assertDictEqual(self.cache.cached_input_ids, {}, )
|
||||
self.assertDictEqual(self.cache.cached_outputs, {}, )
|
||||
self.assertDictEqual(self.cache.inputs_changed, {}, )
|
||||
|
||||
def test_name(self):
|
||||
assert(self.cache.__name__ == self.cache.operation.__name__)
|
||||
|
||||
if __name__ == "__main__":
|
||||
#import sys;sys.argv = ['', 'Test.testName']
|
||||
unittest.main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue