File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -428,7 +428,7 @@ def __init__(self, **kwargs):
428428 if mode in io_modes_that_create_file or manager is not None or extensions is not None :
429429 load_namespaces = False
430430
431- if mode in io_modes_that_create_file and not str (path ).endswith ('.nwb' ):
431+ if mode in io_modes_that_create_file and path is not None and not str (path ).endswith ('.nwb' ):
432432 warn (f"The file path provided: { path } does not end in '.nwb'. "
433433 "It is recommended that NWB files using the HDF5 backend use the '.nwb' extension." , UserWarning )
434434
Original file line number Diff line number Diff line change 11import numpy as np
22import pandas as pd
33
4+ import h5py
5+ import io
6+ import warnings
7+
48from datetime import datetime , timedelta
59from dateutil .tz import tzlocal , tzutc
610from hdmf .common import DynamicTable
@@ -711,3 +715,12 @@ class TestTimezone(TestCase):
711715 def test_raise_warning__add_missing_timezone (self ):
712716 with self .assertWarnsWith (UserWarning , "Date is missing timezone information. Updating to local timezone." ):
713717 _add_missing_timezone (datetime (2017 , 5 , 1 , 12 ))
718+
719+ class TestNoWarningWithoutPath (TestCase ):
720+ def test_raise_warning (self ):
721+ with warnings .catch_warnings ():
722+ warnings .simplefilter ("error" )
723+
724+ data = io .BytesIO ()
725+ h5file = h5py .File (data , "w" )
726+ NWBHDF5IO (mode = "w" , file = h5file )
You can’t perform that action at this time.
0 commit comments