Skip to content

Commit c7e07cd

Browse files
Update Field.del_construct unit test to check cyclic() tidy
1 parent 5551121 commit c7e07cd

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

cf/test/test_Field.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2594,7 +2594,19 @@ def test_Field_del_construct(self):
25942594
f.del_construct("measure:area"), cf.CellMeasure
25952595
)
25962596

2597-
# TODO test cyclic nature
2597+
# Test a field with cyclic axes, to ensure the cyclic() set is
2598+
# updated accordingly if a cyclic axes is the one removed.
2599+
g = cf.example_field(2) # this has a cyclic axes 'domainaxis2'
2600+
# To delete a cyclic axes, must first delete this dimension coordinate
2601+
# because 'domainaxis2' spans it.
2602+
self.assertIsInstance(
2603+
g.del_construct("dimensioncoordinate2"), cf.DimensionCoordinate
2604+
)
2605+
self.assertEqual(g.cyclic(), set(("domainaxis2",)))
2606+
self.assertIsInstance(
2607+
g.del_construct("domainaxis2"), cf.DomainAxis
2608+
)
2609+
self.assertEqual(g.cyclic(), set())
25982610

25992611
def test_Field_persist(self):
26002612
"""Test the `persist` Field method."""

0 commit comments

Comments
 (0)