MCPcopy Create free account
hub / github.com/Derive-Risk/pyfair / test_creation

Method test_creation

tests/model/test_model.py:19–35  ·  view source on GitHub ↗

Test basic instantiation.

(self)

Source from the content-addressed store, hash-verified

17 META_MODEL_JSON = '{ "Regular Model 1": { "Loss Event Frequency": { "low": 20, "mode": 100, "high": 900 }, "Loss Magnitude": { "low": 3000000, "mode": 3500000, "high": 5000000 }, "name": "Regular Model 1", "n_simulations": 10000, "random_seed": 42, "model_uuid": "b6c6c968-a03c-11e9-a5db-f26e0bbd6dbc", "type": "FairModel", "creation_date": "2019-07-06 17:23:43.647370" }, "Regular Model 2": { "Loss Event Frequency": { "mean": 0.3, "stdev": 0.1 }, "Loss Magnitude": { "low": 2000000000, "mode": 3000000000, "high": 5000000000 }, "name": "Regular Model 2", "n_simulations": 10000, "random_seed": 42, "model_uuid": "b6ca98a4-a03c-11e9-8ce0-f26e0bbd6dbc", "type": "FairModel", "creation_date": "2019-07-06 17:23:43.672336" }, "name": "My Meta Model!", "model_uuid": "b6cce298-a03c-11e9-b79f-f26e0bbd6dbc", "creation_date": "2019-07-06 17:23:43.687336", "type": "FairMetaModel" }'
18
19 def test_creation(self):
20 """Test basic instantiation."""
21 # Create FairModel
22 model = FairModel('Test', self.N_SAMPLES, random_seed=42)
23 # Ensure existence of appropriate attributes
24 attributes = [
25 model._tree,
26 model._data_input,
27 model._calculation,
28 model._model_uuid,
29 model._creation_date,
30 ]
31 for attribute in attributes:
32 self.assertTrue(attribute)
33
34 # Check that the table is of proper
35 self.assertEqual(len(model._model_table.columns), self.MODEL_TABLE_COLUMN_COUNT)
36
37 def test_read_json(self):
38 """Test static method for reading JSON"""

Callers

nothing calls this directly

Calls 1

FairModelClass · 0.90

Tested by

no test coverage detected