elephant.test.test_neo_tools module — Elephant 0.5.0 documentation

# elephant.test.test_neo_tools module

Unit tests for the neo_tools module.

class `elephant.test.test_neo_tools.` `ExtractNeoAttrsTestCase`(methodName='runTest')

  Bases: `unittest.case.TestCase`

  Methods

  `assert_dicts_equal`(d1, d2)

    Assert that two dictionaries are equal, taking into account arrays.

    Normally, unittest.TestCase.assertEqual doesn’t work with dictionaries containing arrays. This works around that.

    Parameters: | d1, d2 : dict The dictionaries to compare
    Returns: | Nothing
    Raises: | AssertionError : If the d1 and d2 are not equal.

  `setUp`()
  `test__extract_neo_attrs__epoch_noarray`()
  `test__extract_neo_attrs__epoch_noparents_array`()
  `test__extract_neo_attrs__epoch_noparents_noarray`()
  `test__extract_neo_attrs__epoch_parents_childfirst_array`()
  `test__extract_neo_attrs__epoch_parents_childfirst_noarray`()
  `test__extract_neo_attrs__epoch_parents_empty_array`()
  `test__extract_neo_attrs__epoch_parents_parentfirst_array`()
  `test__extract_neo_attrs__epoch_parents_parentfirst_noarray`()
  `test__extract_neo_attrs__event_noarray`()
  `test__extract_neo_attrs__event_noparents_array`()
  `test__extract_neo_attrs__event_noparents_noarray`()
  `test__extract_neo_attrs__event_parents_childfirst_array`()
  `test__extract_neo_attrs__event_parents_childfirst_noarray`()
  `test__extract_neo_attrs__event_parents_empty_array`()
  `test__extract_neo_attrs__event_parents_parentfirst_array`()
  `test__extract_neo_attrs__event_parents_parentfirst_noarray`()
  `test__extract_neo_attrs__spiketrain_noarray`()
  `test__extract_neo_attrs__spiketrain_noarray_skip_none`()
  `test__extract_neo_attrs__spiketrain_noparents_array`()
  `test__extract_neo_attrs__spiketrain_noparents_noarray`()
  `test__extract_neo_attrs__spiketrain_parents_childfirst_array`()
  `test__extract_neo_attrs__spiketrain_parents_childfirst_noarray`()
  `test__extract_neo_attrs__spiketrain_parents_empty_array`()
  `test__extract_neo_attrs__spiketrain_parents_parentfirst_array`()
  `test__extract_neo_attrs__spiketrain_parents_parentfirst_noarray`()

class `elephant.test.test_neo_tools.` `GetAllEpochsTestCase`(methodName='runTest')

  Bases: `unittest.case.TestCase`

  Methods

  `test__get_all_epochs__block`()
  `test__get_all_epochs__dict`()
  `test__get_all_epochs__epoch`()
  `test__get_all_epochs__iter`()
  `test__get_all_epochs__list`()
  `test__get_all_epochs__segment`()
  `test__get_all_epochs__tuple`()

class `elephant.test.test_neo_tools.` `GetAllEventsTestCase`(methodName='runTest')

  Bases: `unittest.case.TestCase`

  Methods

  `test__get_all_events__block`()
  `test__get_all_events__dict`()
  `test__get_all_events__event`()
  `test__get_all_events__iter`()
  `test__get_all_events__list`()
  `test__get_all_events__segment`()
  `test__get_all_events__tuple`()

class `elephant.test.test_neo_tools.` `GetAllObjsTestCase`(methodName='runTest')

  Bases: `unittest.case.TestCase`

  Methods

  `test__get_all_objs__block_epoch`()
  `test__get_all_objs__dict_spiketrain`()
  `test__get_all_objs__empty_dict`()
  `test__get_all_objs__empty_itert`()
  `test__get_all_objs__empty_list`()
  `test__get_all_objs__empty_nested_dict`()
  `test__get_all_objs__empty_nested_iter`()
  `test__get_all_objs__empty_nested_list`()
  `test__get_all_objs__empty_nested_many`()
  `test__get_all_objs__epoch_for_event_valueerror`()
  `test__get_all_objs__float_valueerror`()
  `test__get_all_objs__iter_spiketrain`()
  `test__get_all_objs__list_float_valueerror`()
  `test__get_all_objs__list_spiketrain`()
  `test__get_all_objs__nested_dict_spiketrain`()
  `test__get_all_objs__nested_iter_epoch`()
  `test__get_all_objs__nested_list_epoch`()
  `test__get_all_objs__nested_many_spiketrain`()
  `test__get_all_objs__spiketrain`()
  `test__get_all_objs__unit_spiketrain`()

class `elephant.test.test_neo_tools.` `GetAllSpiketrainsTestCase`(methodName='runTest')

  Bases: `unittest.case.TestCase`

  Methods

  `test__get_all_spiketrains__block`()
  `test__get_all_spiketrains__dict`()
  `test__get_all_spiketrains__iter`()
  `test__get_all_spiketrains__list`()
  `test__get_all_spiketrains__segment`()
  `test__get_all_spiketrains__spiketrain`()
  `test__get_all_spiketrains__tuple`()
  `test__get_all_spiketrains__unit`()

`elephant.test.test_neo_tools.` `strip_iter_values`(targ, array_attrs=[u'waveforms', u'times', u'durations', u'labels', u'index', u'channel_names', u'channel_ids', u'coordinates'])

  Remove iterable, non-string values from a dictionary.

  elephant.neo_tools.extract_neo_attrs automatically strips out non-scalar values from attributes. This function does the same to a manually-extracted dictionary.

  Parameters: | targ : dict The dictionary of values to process. array_attrs : list of str objects, optional The list of attribute names to remove. If not specified, uses elephant.test.test_neo_tools.ARRAY_ATTRS.
  Returns: | dict A copy of targ with the target values (if present) removed.

  Notes

  Always returns a copy, even if nothing was removed.

  This function has the values to remove hard-coded. This is intentional to make sure that extract_neo_attrs is removing all the attributes it is supposed to and only the attributes it is supposed to. Please do NOT change this to any sort of automatic detection, if it is missing values please add them manually.