<s> from __future__ import division , print_function , unicode_literals <EOL> import pytest <EOL> from sacred . config . custom_containers import FallbackDict <EOL> @ pytest . fixture <EOL> def fbdict ( ) : <EOL> return FallbackDict ( { '<STR_LIT>' : <NUM_LIT:7> , '<STR_LIT>' : True } ) <EOL> def test_is_dictionary ( fbdict ) : <EOL> assert isinstance ( fbdict , dict ) <EOL> def test_getitem ( fbdict ) : <EOL> assert '<STR_LIT:foo>' not in fbdict <EOL> fbdict [ '<STR_LIT:foo>' ] = <NUM_LIT> <EOL> assert '<STR_LIT:foo>' in fbdict <EOL> assert fbdict [ '<STR_LIT:foo>' ] == <NUM_LIT> <EOL> def test_fallback ( fbdict ) : <EOL> assert '<STR_LIT>' in fbdict <EOL> assert fbdict [ '<STR_LIT>' ] == <NUM_LIT:7> <EOL> fbdict [ '<STR_LIT>' ] = <NUM_LIT:8> <EOL> assert fbdict [ '<STR_LIT>' ] == <NUM_LIT:8> <EOL> def test_get ( fbdict ) : <EOL> fbdict [ '<STR_LIT:a>' ] = '<STR_LIT:b>' <EOL> assert fbdict . get ( '<STR_LIT:a>' , <NUM_LIT> ) == '<STR_LIT:b>' <EOL> assert fbdict . get ( '<STR_LIT>' , <NUM_LIT> ) == <NUM_LIT:7> <EOL> assert fbdict . get ( '<STR_LIT>' , <NUM_LIT> ) == <NUM_LIT> <EOL> assert fbdict . get ( '<STR_LIT>' , <NUM_LIT> ) is True <EOL> @ pytest . mark . parametrize ( '<STR_LIT>' , <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def test_not_implemented ( method , fbdict ) : <EOL> with pytest . raises ( NotImplementedError ) : <EOL> getattr ( fbdict , method ) ( ) <EOL> def test_special_not_implemented ( fbdict ) : <EOL> with pytest . raises ( NotImplementedError ) : <EOL> fbdict . pop ( '<STR_LIT>' ) <EOL> with pytest . raises ( NotImplementedError ) : <EOL> fbdict . setdefault ( '<STR_LIT>' , None ) </s>
