Chromium Code Reviews| Index: appengine/findit/crash/loglinear/test/training_test.py |
| diff --git a/appengine/findit/crash/loglinear/test/training_test.py b/appengine/findit/crash/loglinear/test/training_test.py |
| index afb8ecc5fb9297b82312cfdd0de11673f749e68f..c0193a583210539734a9b7dff83f7de70d6cf3ed 100644 |
| --- a/appengine/findit/crash/loglinear/test/training_test.py |
| +++ b/appengine/findit/crash/loglinear/test/training_test.py |
| @@ -4,7 +4,6 @@ |
| import numpy as np |
| -from crash.loglinear.model import ToFeatureFunction |
| from crash.loglinear.training import TrainableLogLinearModel |
| from crash.loglinear.test.loglinear_testcase import LoglinearTestCase |
| @@ -20,8 +19,8 @@ class TrainableLogLinearModelTest(LoglinearTestCase): |
| self._Y, training_data, self._feature_function, self._weights) |
| def testWeightsSetterNotAnNdarray(self): |
| - def _WeightSettingExpression(): |
| - """Wrap the ``self._model.weights = stuff`` expression. |
| + def _NpWeightSettingExpression(): |
| + """Wrap the ``self._model.np_weights = stuff`` expression. |
| The ``assertRaises`` method expects a callable object, so we need |
| to wrap the expression in a def. If we didn't wrap it in a def |
| @@ -31,17 +30,9 @@ class TrainableLogLinearModelTest(LoglinearTestCase): |
| we want to check is actually a statement it can't be in a lambda |
| but rather must be in a def. |
| """ |
| - self._model.weights = 'this is not an np.ndarray' |
| + self._model.np_weights = 'this is not an np.ndarray' |
| - self.assertRaises(TypeError, _WeightSettingExpression) |
| - |
| - def testWeightsSetterShapeMismatch(self): |
|
wrengr
2017/01/12 19:09:09
We probably still want something similar to this.
Sharu Jiang
2017/01/13 01:08:35
Oops, forgot to add this back.
|
| - def _WeightSettingExpression(): |
| - """Wrap the ``self._model.weights = stuff`` expression.""" |
| - # This np.ndarray has the wrong shape. |
| - self._model.weights = np.array([[1,2], [3,4]]) |
| - |
| - self.assertRaises(TypeError, _WeightSettingExpression) |
| + self.assertRaises(TypeError, _NpWeightSettingExpression) |
| def testTrainWeights(self): |
| """Tests that ``TrainWeights`` actually improves the loglikelihood. |