예제 #1
0
 def test_restore_when_bad_key(self):
     with theano.configparser.change_flags(compute_test_value='off'):
         with pytest.raises(ValueError):
             conf = collections.OrderedDict(
                 [('compute_test_value', 'raise'), ('bad_key', True)])
             set_theano_conf(conf)
         assert theano.config.compute_test_value == 'off'
예제 #2
0
 def test_restore_when_bad_key(self):
     with theano.configparser.change_flags(compute_test_value='off'):
         with pytest.raises(ValueError):
             conf = collections.OrderedDict([('compute_test_value',
                                              'raise'), ('bad_key', True)])
             set_theano_conf(conf)
         assert theano.config.compute_test_value == 'off'
예제 #3
0
 def test_restore_when_bad_key(self):
     with theano.configparser.change_flags(compute_test_value="off"):
         with pytest.raises(ValueError):
             conf = collections.OrderedDict([("compute_test_value",
                                              "raise"), ("bad_key", True)])
             set_theano_conf(conf)
         assert theano.config.compute_test_value == "off"
예제 #4
0
파일: model.py 프로젝트: hanbman/pymc3
 def __exit__(self, typ, value, traceback):
     type(self).get_contexts().pop()
     # self._theano_config is set in Model.__new__
     if hasattr(self, '_old_theano_config'):
         set_theano_conf(self._old_theano_config)
예제 #5
0
파일: model.py 프로젝트: hanbman/pymc3
 def __enter__(self):
     type(self).get_contexts().append(self)
     # self._theano_config is set in Model.__new__
     if hasattr(self, '_theano_config'):
         self._old_theano_config = set_theano_conf(self._theano_config)
     return self
예제 #6
0
 def test_restore(self):
     with theano.configparser.change_flags(compute_test_value="off"):
         conf = set_theano_conf({"compute_test_value": "raise"})
         assert conf == {"compute_test_value": "off"}
         conf = set_theano_conf(conf)
         assert conf == {"compute_test_value": "raise"}
예제 #7
0
 def test_invalid_key(self):
     with pytest.raises(ValueError) as e:
         set_theano_conf({"bad_key": True})
     e.match("Unknown")
예제 #8
0
 def test_restore(self):
     with theano.configparser.change_flags(compute_test_value='off'):
         conf = set_theano_conf({'compute_test_value': 'raise'})
         assert conf == {'compute_test_value': 'off'}
         conf = set_theano_conf(conf)
         assert conf == {'compute_test_value': 'raise'}
예제 #9
0
파일: model.py 프로젝트: bballamudi/pymc3
 def __exit__(self, typ, value, traceback):
     type(self).get_contexts().pop()
     # self._theano_config is set in Model.__new__
     if hasattr(self, '_old_theano_config'):
         set_theano_conf(self._old_theano_config)
예제 #10
0
파일: model.py 프로젝트: bballamudi/pymc3
 def __enter__(self):
     type(self).get_contexts().append(self)
     # self._theano_config is set in Model.__new__
     if hasattr(self, '_theano_config'):
         self._old_theano_config = set_theano_conf(self._theano_config)
     return self
예제 #11
0
 def test_invalid_key(self):
     with pytest.raises(ValueError) as e:
         set_theano_conf({'bad_key': True})
     e.match('Unknown')
예제 #12
0
 def test_restore(self):
     with theano.configparser.change_flags(compute_test_value='off'):
         conf = set_theano_conf({'compute_test_value': 'raise'})
         assert conf == {'compute_test_value': 'off'}
         conf = set_theano_conf(conf)
         assert conf == {'compute_test_value': 'raise'}