-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
02906d8
commit 35bb37c
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import pytest | ||
|
||
from tests.utils import create_fieldset_unit_mesh | ||
|
||
fieldset = create_fieldset_unit_mesh() | ||
field = fieldset.U | ||
|
||
private_field_attrs = [ | ||
"_dataFiles", | ||
"_loaded_time_indices", | ||
"_creation_log", | ||
"_data_chunks", | ||
"_c_data_chunks", | ||
"_chunk_set", | ||
] | ||
|
||
private_fieldset_attrs = [ | ||
"_completed", | ||
] | ||
|
||
|
||
@pytest.mark.parametrize("private_attribute", private_field_attrs) | ||
def test_private_attribute_field(private_attribute): | ||
assert private_attribute.startswith("_") | ||
attribute = private_attribute.lstrip("_") | ||
|
||
with pytest.raises(DeprecationWarning): | ||
assert hasattr(field, attribute) | ||
assert hasattr(field, private_attribute) | ||
assert getattr(field, attribute) == getattr(field, private_attribute) | ||
|
||
|
||
@pytest.mark.parametrize("private_attribute", private_fieldset_attrs) | ||
def test_private_attribute_fieldset(private_attribute): | ||
assert private_attribute.startswith("_") | ||
attribute = private_attribute.lstrip("_") | ||
|
||
with pytest.raises(DeprecationWarning): | ||
assert hasattr(fieldset, attribute) | ||
assert hasattr(fieldset, private_attribute) | ||
assert getattr(fieldset, attribute) == getattr(fieldset, private_attribute) | ||