elephant.test.test_neo_tools module

Unit tests for the neo_tools module.

class elephant.test.test_neo_tools.ExtractNeoAttrsTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

Methods

assert_dicts_equal(d1, d2)[source]

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()[source]
test__extract_neo_attrs__epoch_noarray()[source]
test__extract_neo_attrs__epoch_noparents_array()[source]
test__extract_neo_attrs__epoch_noparents_noarray()[source]
test__extract_neo_attrs__epoch_parents_childfirst_array()[source]
test__extract_neo_attrs__epoch_parents_childfirst_noarray()[source]
test__extract_neo_attrs__epoch_parents_empty_array()[source]
test__extract_neo_attrs__epoch_parents_parentfirst_array()[source]
test__extract_neo_attrs__epoch_parents_parentfirst_noarray()[source]
test__extract_neo_attrs__event_noarray()[source]
test__extract_neo_attrs__event_noparents_array()[source]
test__extract_neo_attrs__event_noparents_noarray()[source]
test__extract_neo_attrs__event_parents_childfirst_array()[source]
test__extract_neo_attrs__event_parents_childfirst_noarray()[source]
test__extract_neo_attrs__event_parents_empty_array()[source]
test__extract_neo_attrs__event_parents_parentfirst_array()[source]
test__extract_neo_attrs__event_parents_parentfirst_noarray()[source]
test__extract_neo_attrs__spiketrain_noarray()[source]
test__extract_neo_attrs__spiketrain_noarray_skip_none()[source]
test__extract_neo_attrs__spiketrain_noparents_array()[source]
test__extract_neo_attrs__spiketrain_noparents_noarray()[source]
test__extract_neo_attrs__spiketrain_parents_childfirst_array()[source]
test__extract_neo_attrs__spiketrain_parents_childfirst_noarray()[source]
test__extract_neo_attrs__spiketrain_parents_empty_array()[source]
test__extract_neo_attrs__spiketrain_parents_parentfirst_array()[source]
test__extract_neo_attrs__spiketrain_parents_parentfirst_noarray()[source]
class elephant.test.test_neo_tools.GetAllEpochsTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

Methods

test__get_all_epochs__block()[source]
test__get_all_epochs__dict()[source]
test__get_all_epochs__epoch()[source]
test__get_all_epochs__iter()[source]
test__get_all_epochs__list()[source]
test__get_all_epochs__segment()[source]
test__get_all_epochs__tuple()[source]
class elephant.test.test_neo_tools.GetAllEventsTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

Methods

test__get_all_events__block()[source]
test__get_all_events__dict()[source]
test__get_all_events__event()[source]
test__get_all_events__iter()[source]
test__get_all_events__list()[source]
test__get_all_events__segment()[source]
test__get_all_events__tuple()[source]
class elephant.test.test_neo_tools.GetAllObjsTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

Methods

test__get_all_objs__block_epoch()[source]
test__get_all_objs__dict_spiketrain()[source]
test__get_all_objs__empty_dict()[source]
test__get_all_objs__empty_itert()[source]
test__get_all_objs__empty_list()[source]
test__get_all_objs__empty_nested_dict()[source]
test__get_all_objs__empty_nested_iter()[source]
test__get_all_objs__empty_nested_list()[source]
test__get_all_objs__empty_nested_many()[source]
test__get_all_objs__epoch_for_event_valueerror()[source]
test__get_all_objs__float_valueerror()[source]
test__get_all_objs__iter_spiketrain()[source]
test__get_all_objs__list_float_valueerror()[source]
test__get_all_objs__list_spiketrain()[source]
test__get_all_objs__nested_dict_spiketrain()[source]
test__get_all_objs__nested_iter_epoch()[source]
test__get_all_objs__nested_list_epoch()[source]
test__get_all_objs__nested_many_spiketrain()[source]
test__get_all_objs__spiketrain()[source]
test__get_all_objs__unit_spiketrain()[source]
class elephant.test.test_neo_tools.GetAllSpiketrainsTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

Methods

test__get_all_spiketrains__block()[source]
test__get_all_spiketrains__dict()[source]
test__get_all_spiketrains__iter()[source]
test__get_all_spiketrains__list()[source]
test__get_all_spiketrains__segment()[source]
test__get_all_spiketrains__spiketrain()[source]
test__get_all_spiketrains__tuple()[source]
test__get_all_spiketrains__unit()[source]
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'])[source]

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.