def test_calculation(self):
     """Run a calulate all."""
     # Test regular instantiation
     m1 = FairModel.read_json(self._MODEL_JSON)
     m2 = FairModel.read_json(self._MODEL_JSON)
     self._meta = FairMetaModel('New Model', [m1, m2])
     # Test before
     self.assertFalse(self._meta.calculation_completed())
     # Calculate
     self._meta.calculate_all()
     # Test after
     self.assertTrue(self._meta.calculation_completed())
 def test_creation(self):
     """Test basic instantiation"""
     # Ensure existence of appropriate attributes
     self.assertTrue(self._meta._model_uuid)
     self.assertTrue(self._meta._creation_date)
     # Check that the table is of proper-ish
     self.assertEqual(len(self._meta._risk_table.columns),
                      self._RISK_TABLE_COLUMN_COUNT)
     # Test regular instantiation
     m1 = FairModel.read_json(self._MODEL_JSON)
     m2 = FairModel.read_json(self._MODEL_JSON)
     self._meta = FairMetaModel('New Model', [m1, m2])
     # Throw garbage in metamodel
     self.assertRaises(FairException, FairMetaModel, 'Garnage Name',
                       ['Garbage Input'])
Exemple #3
0
 def test_read_json(self):
     """Test static method for reading JSON"""
     # Instantiate model
     model = FairModel.read_json(self.MODEL_JSON)
     self.assertTrue(model)
     # Ensure metamodel fails
     self.assertRaises(FairException, FairModel.read_json,
                       self.META_MODEL_JSON)