Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

## PyNWB 3.1.3 (Unreleased)

### Fixed
- Fixed incorrect warning for path not ending in `.nwb` when no path argument was provided. @t-b [#2130](https://github.com/NeurodataWithoutBorders/pynwb/pull/2130)

### Documentation and tutorial enhancements
- Change UI of assistant to be an accordion that is always visible. [#2124](https://github.com/NeurodataWithoutBorders/pynwb/pull/2124)


## PyNWB 3.1.2 (August 13, 2025)

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion src/pynwb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ def __init__(self, **kwargs):
if mode in io_modes_that_create_file or manager is not None or extensions is not None:
load_namespaces = False

if mode in io_modes_that_create_file and not str(path).endswith('.nwb'):
if mode in io_modes_that_create_file and path is not None and not str(path).endswith('.nwb'):
warn(f"The file path provided: {path} does not end in '.nwb'. "
"It is recommended that NWB files using the HDF5 backend use the '.nwb' extension.", UserWarning)

Expand Down
13 changes: 13 additions & 0 deletions tests/unit/test_file.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import numpy as np
import pandas as pd

import h5py
import io
import warnings

from datetime import datetime, timedelta
from dateutil.tz import tzlocal, tzutc
from hdmf.common import DynamicTable
Expand Down Expand Up @@ -711,3 +715,12 @@ class TestTimezone(TestCase):
def test_raise_warning__add_missing_timezone(self):
with self.assertWarnsWith(UserWarning, "Date is missing timezone information. Updating to local timezone."):
_add_missing_timezone(datetime(2017, 5, 1, 12))

class TestNoWarningWithoutPath(TestCase):
def test_raise_warning(self):
with warnings.catch_warnings():
warnings.simplefilter("error")

data = io.BytesIO()
h5file = h5py.File(data, "w")
NWBHDF5IO(mode = "w", file = h5file)
Loading