<s> import numpy <EOL> from numpy . testing import assert_equal , assert_raises <EOL> from fuel . datasets import IterableDataset , IndexableDataset <EOL> from fuel . schemes import SequentialExampleScheme , SequentialScheme <EOL> from fuel . streams import AbstractDataStream , DataStream <EOL> class DummyDataStream ( AbstractDataStream ) : <EOL> def reset ( self ) : <EOL> pass <EOL> def close ( self ) : <EOL> pass <EOL> def next_epoch ( self ) : <EOL> pass <EOL> def get_epoch_iterator ( self , as_dict = False ) : <EOL> pass <EOL> def get_data ( self , request = None ) : <EOL> pass <EOL> class TestAbstractDataStream ( object ) : <EOL> def test_raises_value_error_on_no_scheme_no_produces_examples ( self ) : <EOL> stream = DummyDataStream ( ) <EOL> assert_raises ( ValueError , getattr , stream , '<STR_LIT>' ) <EOL> def test_raises_value_error_when_setting_produces_examples_if_scheme ( self ) : <EOL> stream = DummyDataStream ( SequentialExampleScheme ( <NUM_LIT:2> ) ) <EOL> assert_raises ( ValueError , setattr , stream , '<STR_LIT>' , True ) <EOL> class TestDataStream ( object ) : <EOL> def setUp ( self ) : <EOL> self . dataset = IterableDataset ( numpy . eye ( <NUM_LIT:2> ) ) <EOL> def test_sources_setter ( self ) : <EOL> stream = DataStream ( self . dataset ) <EOL> stream . sources = ( '<STR_LIT>' , ) <EOL> assert_equal ( stream . sources , ( '<STR_LIT>' , ) ) <EOL> def test_no_axis_labels ( self ) : <EOL> stream = DataStream ( self . dataset ) <EOL> assert stream . axis_labels is None <EOL> def test_axis_labels_on_produces_examples ( self ) : <EOL> axis_labels = { '<STR_LIT:data>' : ( '<STR_LIT>' , '<STR_LIT>' ) } <EOL> self . dataset . axis_labels = axis_labels <EOL> stream = DataStream ( self . dataset ) <EOL> assert_equal ( stream . axis_labels , { '<STR_LIT:data>' : ( '<STR_LIT>' , ) } ) <EOL> def test_axis_labels_on_produces_batches ( self ) : <EOL> dataset = IndexableDataset ( numpy . eye ( <NUM_LIT:2> ) ) <EOL> axis_labels = { '<STR_LIT:data>' : ( '<STR_LIT>' , '<STR_LIT>' ) } <EOL> dataset . axis_labels = axis_labels <EOL> stream = DataStream ( dataset , iteration_scheme = SequentialScheme ( <NUM_LIT:2> , <NUM_LIT:2> ) ) <EOL> assert_equal ( stream . axis_labels , axis_labels ) <EOL> def test_produces_examples ( self ) : <EOL> stream = DataStream ( self . dataset , <EOL> iteration_scheme = SequentialExampleScheme ( <NUM_LIT:2> ) ) <EOL> assert stream . produces_examples </s>
