Skip to content

Commit

Permalink
Fix path to test maxwell metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
atspaeth committed May 23, 2024
1 parent fa66a87 commit ef436a6
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions tests/datasets_electrophysiology.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import unittest
import tempfile
import shutil
import diskcache
import json
import shutil
import tempfile
import threading
import braingeneers
import unittest
from unittest.mock import patch

import diskcache
import numpy as np

import braingeneers.data.datasets_electrophysiology as ephys
from braingeneers import skip_unittest_if_offline
import braingeneers.utils.smart_open_braingeneers as smart_open
import boto3
import numpy as np
from unittest.mock import patch
from braingeneers import skip_unittest_if_offline
from braingeneers.data.datasets_electrophysiology import cached_load_data
from unittest.mock import patch


class MaxwellReaderTests(unittest.TestCase):
Expand Down Expand Up @@ -113,17 +112,17 @@ def test_non_int_offset_length(self):

def test_modify_maxwell_metadata(self):
"""Update an older Maxwell metadata json with new metadata and NWB file paths, if they exist."""
with open('test_data/maxwell-metadata.old.json', 'r') as f:
with open('tests/test_data/maxwell-metadata.old.json', 'r') as f:
metadata = json.load(f)
# use mock to ensure that new NWB files ALWAYS exist
with patch('__main__.s3wrangler.does_object_exist') as mock_does_object_exist:
with patch('braingeneers.utils.s3wrangler.does_object_exist') as mock_does_object_exist:
mock_does_object_exist.return_value = True
modified_metadata = ephys.modify_metadata_maxwell_raw_to_nwb(metadata)
assert isinstance(modified_metadata['timestamp'], str)
assert len(modified_metadata['timestamp']) == len('2023-10-05T18:10:02')
modified_metadata['timestamp'] = ''

with open('test_data/maxwell-metadata.expected.json', 'r') as f:
with open('tests/test_data/maxwell-metadata.expected.json', 'r') as f:
expected_metadata = json.load(f)
expected_metadata['timestamp'] = ''

Expand Down

0 comments on commit ef436a6

Please sign in to comment.