def test_ensure_dict_field_existing(): builder = ConferenceBuilder() builder.record['existing_dict'] = {'some_dict': 'some_value'} builder._ensure_dict_field('existing_dict') assert builder.record['existing_dict'] == {'some_dict': 'some_value'}
def test_ensure_dict_field_missing(): builder = ConferenceBuilder() builder.record['existing_dict'] = {'some_dict': 'some_value'} assert 'dict_field' not in builder.record builder._ensure_dict_field('dict_field') assert 'dict_field' in builder.record assert builder.record['dict_field'] == {}