def test_save_to_archive_with_no_job_source_with_values(self):
        provenance = Provenance()
        mock_archive = self.MockArchive()

        provenance.environment = {'python': 2}
        provenance.config = {'log_level': 'DEBUG'}
        provenance.tags = ['run_one']
        provenance.random_state = 'this is a random state'
        provenance.module_versions = {'pandas': 0.2}
        provenance.pip_freeze = 'pandas==0.2'
        provenance.python_version = {'major': 2}
        provenance.job_run_data = {'layers': 99, 'neurons_per_layer': 9999}
        provenance.project_name = 'a different project'
        provenance.user_name = 'Richard Hamming'
        provenance.save_to_archive(mock_archive)

        self.assertDictContainsSubset(
            {
                'config': {
                    'log_level': 'DEBUG'
                },
                'environment': {
                    'python': 2
                },
                'module_versions': {
                    'pandas': 0.2
                },
                'pip_freeze': 'pandas==0.2',
                'python_version': {
                    'major': 2
                },
                'random_state': 'this is a random state',
                'tags': ['run_one'],
                'job_run_data': {
                    'layers': 99,
                    'neurons_per_layer': 9999
                },
                'project_name': 'a different project',
                'user_name': 'Richard Hamming'
            }, mock_archive.archive_provenance)
    def test_load_provenance_from_archive_with_specific_value_persists(self):
        provenance = Provenance()
        mock_archive = self.MockArchive()

        provenance.environment = {'python': 2}
        provenance.config = {'log_level': 'DEBUG'}
        provenance.tags = ['run_one']
        provenance.random_state = 'this is a random state'
        provenance.module_versions = {'pandas': 0.2}
        provenance.pip_freeze = 'pandas==0.2'
        provenance.python_version = {'major': 2}
        provenance.job_run_data = {'layers': 99, 'neurons_per_layer': 9999}
        provenance.project_name = 'my wonderful project'
        provenance.user_name = 'Alan Turing'
        provenance.annotations = {'model': 'mlp', 'layer': 'all of them'}
        provenance.save_to_archive(mock_archive)

        provenance_two = Provenance()
        provenance_two.load_provenance_from_archive(mock_archive)

        self.assertEqual(provenance_two.environment, {'python': 2})
        self.assertEqual(provenance_two.config, {'log_level': 'DEBUG'})
        self.assertEqual(provenance_two.tags, ['run_one'])
        self.assertEqual(provenance_two.random_state, 'this is a random state')
        self.assertEqual(provenance_two.module_versions, {'pandas': 0.2})
        self.assertEqual(provenance_two.pip_freeze, 'pandas==0.2')
        self.assertEqual(provenance_two.python_version, {'major': 2})
        self.assertEqual(provenance_two.job_run_data, {
            'layers': 99,
            'neurons_per_layer': 9999
        })
        self.assertEqual(provenance_two.project_name, 'my wonderful project')
        self.assertEqual(provenance_two.user_name, 'Alan Turing')
        self.assertEqual(provenance_two.annotations, {
            'model': 'mlp',
            'layer': 'all of them'
        })