Skip to content

Commit 65fbc8d

Browse files
authored
Merge branch 'main' into um-version
2 parents b0119f5 + 7a09fef commit 65fbc8d

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

Changelog.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
version NEXTRELEASE
1+
version NEXTVERSION
22
-------------------
33

44
**2024-??-??**
55

66
* Include the UM version as a field property when reading UM files
77
(https://github.com/NCAS-CMS/cf-python/issues/777)
8+
* Fix bug where `cf.example_fields` returned a `list`
9+
of Fields rather than a `Fieldlist`
10+
(https://github.com/NCAS-CMS/cf-python/issues/725)
811

912
----
1013

cf/examplefield.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import cfdm
22

33
from .cfimplementation import implementation
4+
from .fieldlist import FieldList
45

56
_implementation = implementation()
67

@@ -13,7 +14,7 @@ def example_field(n, _implementation=_implementation):
1314

1415

1516
def example_fields(*n, _func=example_field):
16-
return cfdm.example_fields(*n, _func=_func)
17+
return FieldList(cfdm.example_fields(*n, _func=_func))
1718

1819

1920
example_fields.__doc__ = cfdm.example_fields.__doc__.replace("cfdm.", "cf.")

cf/test/test_functions.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@ class functionTest(unittest.TestCase):
1717
def setUp(self):
1818
self.test_only = ()
1919

20-
def test_example_field(self):
21-
for f in cf.example_fields():
20+
def test_example_field_example_fields(self):
21+
e = cf.example_fields()
22+
self.assertIsInstance(e, cf.FieldList)
23+
24+
for f in e:
25+
self.assertIsInstance(f, cf.Field)
2226
f.dump(display=False)
2327

2428
with self.assertRaises(ValueError):

0 commit comments

Comments
 (0)