|
3 | 3 | """
|
4 | 4 |
|
5 | 5 | import unittest
|
| 6 | +import warnings |
6 | 7 |
|
7 | 8 | import numpy as np
|
8 | 9 | import quantities as pq
|
@@ -374,7 +375,10 @@ def test__cut_block_by_epochs(self):
|
374 | 375 | original_block.segments = [seg, seg2]
|
375 | 376 | original_block.create_many_to_one_relationship()
|
376 | 377 |
|
377 |
| - block = cut_block_by_epochs(original_block, properties={'pick': 'me'}) |
| 378 | + with warnings.catch_warnings(record=True) as w: |
| 379 | + # This should raise a warning as one segment does not contain epochs |
| 380 | + block = cut_block_by_epochs(original_block, properties={'pick': 'me'}) |
| 381 | + self.assertEqual(len(w), 1) |
378 | 382 |
|
379 | 383 | assert_neo_object_is_compliant(block)
|
380 | 384 | self.assertEqual(len(block.segments), 3)
|
@@ -430,7 +434,10 @@ def test__cut_block_by_epochs(self):
|
430 | 434 | original_block.segments = [seg, seg2]
|
431 | 435 | original_block.create_many_to_one_relationship()
|
432 | 436 |
|
433 |
| - block = cut_block_by_epochs(original_block, properties={'pick': 'me'}, reset_time=True) |
| 437 | + with warnings.catch_warnings(record=True) as w: |
| 438 | + # This should raise a warning as one segment does not contain epochs |
| 439 | + block = cut_block_by_epochs(original_block, properties={'pick': 'me'}, reset_time=True) |
| 440 | + self.assertEqual(len(w), 1) |
434 | 441 |
|
435 | 442 | assert_neo_object_is_compliant(block)
|
436 | 443 | self.assertEqual(len(block.segments), 3)
|
|
0 commit comments