def test_save(self, json_mock): """Save stores the internal dictionary as a json in a file.""" # Setup instance = Bivariate('frank') instance.fit(self.X) expected_content = { "copula_type": "FRANK", "tau": 0.014492753623188406, "theta": 0.13070829945417198 } # Run instance.save('test.json') # Check assert json_mock.called compare_nested_dicts(json_mock.call_args[0][0], expected_content)
def test_save(self, json_mock, open_mock): """Save stores the internal dictionary as a json in a file.""" # Setup instance = Bivariate(copula_type='frank') instance.fit(self.X) expected_content = { "copula_type": "FRANK", "tau": 0.9128709291752769, "theta": 44.2003852484162 } # Run instance.save('test.json') # Check assert open_mock.called_once_with('test.json', 'w') assert json_mock.called compare_nested_dicts(json_mock.call_args[0][0], expected_content)