Skip to content

Commit

Permalink
[FIX] failing unitests for neo_tools with Neo 0.13.0 (#617)
Browse files Browse the repository at this point in the history
* fix failing unitests for neo_tools

* fix unit test in spike_train_synchrony

* fix unittest test_correct_transfer_of_spiketrain_attributes

* fix pep8

* remove cast to list

* edit inline comments for clarity

* add same object to tests by getting length of list like object in advance

* fix pep8

* remove space

* remove workaround for Neo Issue #1405

* remove space

* add version cap for numpy <2

* undo numpy requiremnts, unintentional commit

---------

Co-authored-by: Moritz-Alexander-Kern <moritz.kern@ymail.com>
  • Loading branch information
Moritz-Alexander-Kern and Moritz-Alexander-Kern authored Mar 22, 2024
1 parent dd3146c commit 7112f84
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
6 changes: 1 addition & 5 deletions elephant/spike_train_synchrony.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,7 @@ def delete_synchrofacts(self, threshold, in_place=False, mode='delete'):
# replace link to spiketrain in segment
new_index = self._get_spiketrain_index(
segment.spiketrains, st)
# Todo: Simplify following lines once Neo SpikeTrainList
# implments indexed assignment of entries (i.e., stl[i]=st)
spiketrainlist = list(segment.spiketrains)
spiketrainlist[new_index] = new_st
segment.spiketrains = spiketrainlist
segment.spiketrains[new_index] = new_st
except ValueError:
# st is not in this segment even though it points to it
warnings.warn(f"The SpikeTrain at index {idx} of the "
Expand Down
7 changes: 1 addition & 6 deletions elephant/test/test_neo_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1167,10 +1167,6 @@ def test__get_all_spiketrains__segment(self):
supported_objects=[neo.core.Segment, neo.core.SpikeTrain])
targ = copy.deepcopy(obj)
obj.spiketrains.append(obj.spiketrains[0])
# TODO: The following is the original line of the test, however, this
# fails with Neo 0.10.0
# Reinstate once issue is fixed
# obj.spiketrains.extend(obj.spiketrains)

res0 = nt.get_all_spiketrains(obj)

Expand Down Expand Up @@ -1320,7 +1316,6 @@ def test__get_all_events__segment(self):
supported_objects=[neo.core.Segment, neo.core.Event])
targ = copy.deepcopy(obj)

obj.events.extend(obj.events)
res0 = nt.get_all_events(obj)

targ = targ.events
Expand Down Expand Up @@ -1469,7 +1464,7 @@ def test__get_all_epochs__segment(self):
obj = generate_one_simple_segment(
supported_objects=[neo.core.Segment, neo.core.Epoch])
targ = copy.deepcopy(obj)
obj.epochs.extend(obj.epochs)

res0 = nt.get_all_epochs(obj)

targ = targ.epochs
Expand Down

0 comments on commit 7112f84

Please sign in to comment.