gemd 2.2.0__tar.gz → 2.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gemd-2.2.4/PKG-INFO +38 -0
- gemd-2.2.4/gemd/__version__.py +1 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/demo/cake.py +1 -1
- {gemd-2.2.0 → gemd-2.2.4}/gemd/demo/strehlow_and_cook.py +1 -1
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/util.py +3 -1
- {gemd-2.2.0 → gemd-2.2.4}/gemd/units/impl.py +23 -35
- gemd-2.2.4/gemd.egg-info/PKG-INFO +38 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd.egg-info/SOURCES.txt +2 -6
- gemd-2.2.4/gemd.egg-info/requires.txt +5 -0
- gemd-2.2.4/gemd.egg-info/top_level.txt +1 -0
- gemd-2.2.4/pyproject.toml +73 -0
- gemd-2.2.0/PKG-INFO +0 -18
- gemd-2.2.0/gemd/__version__.py +0 -1
- gemd-2.2.0/gemd.egg-info/PKG-INFO +0 -18
- gemd-2.2.0/gemd.egg-info/requires.txt +0 -22
- gemd-2.2.0/gemd.egg-info/top_level.txt +0 -2
- gemd-2.2.0/setup.py +0 -67
- gemd-2.2.0/tests/__init__.py +0 -0
- gemd-2.2.0/tests/units/__init__.py +0 -0
- gemd-2.2.0/tests/units/test_parser.py +0 -233
- gemd-2.2.0/tests/units/test_units.txt +0 -4
- {gemd-2.2.0 → gemd-2.2.4}/LICENSE +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/README.md +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/__init__.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/builders/__init__.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/builders/impl.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/demo/__init__.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/demo/material_run_example.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/demo/measurement_example.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/demo/strehlow_and_cook.pif +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/demo/strehlow_and_cook_small.pif +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/demo/table_example.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/demo/toothpick.jpg +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/__init__.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/attribute/__init__.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/attribute/base_attribute.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/attribute/condition.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/attribute/parameter.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/attribute/property.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/attribute/property_and_conditions.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/base_entity.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/bounds/__init__.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/bounds/base_bounds.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/bounds/categorical_bounds.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/bounds/composition_bounds.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/bounds/integer_bounds.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/bounds/molecular_structure_bounds.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/bounds/real_bounds.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/bounds_validation.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/case_insensitive_dict.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/dict_serializable.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/file_link.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/has_dependencies.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/link_by_uid.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/object/__init__.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/object/base_object.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/object/has_conditions.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/object/has_material.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/object/has_parameters.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/object/has_process.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/object/has_properties.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/object/has_quantities.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/object/has_source.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/object/has_spec.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/object/has_template.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/object/has_template_check_generator.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/object/ingredient_run.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/object/ingredient_spec.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/object/material_run.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/object/material_spec.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/object/measurement_run.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/object/measurement_spec.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/object/process_run.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/object/process_spec.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/setters.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/source/__init__.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/source/performed_source.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/template/__init__.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/template/attribute_template.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/template/base_template.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/template/condition_template.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/template/has_condition_templates.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/template/has_parameter_templates.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/template/has_property_templates.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/template/material_template.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/template/measurement_template.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/template/parameter_template.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/template/process_template.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/template/property_template.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/valid_list.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/value/__init__.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/value/base_value.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/value/categorical_value.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/value/composition_value.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/value/continuous_value.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/value/discrete_categorical.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/value/empirical_formula.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/value/inchi_value.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/value/integer_value.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/value/molecular_value.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/value/nominal_categorical.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/value/nominal_composition.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/value/nominal_integer.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/value/nominal_real.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/value/normal_real.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/value/smiles_value.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/value/uniform_integer.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/entity/value/uniform_real.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/enumeration/__init__.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/enumeration/base_enumeration.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/enumeration/origin.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/enumeration/sample_type.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/json/__init__.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/json/gemd_encoder.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/json/gemd_json.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/units/__init__.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/units/citrine_en.txt +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/units/constants_en.txt +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/util/__init__.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd/util/impl.py +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/gemd.egg-info/dependency_links.txt +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/setup.cfg +0 -0
- {gemd-2.2.0 → gemd-2.2.4}/tests/test_examples.py +0 -0
gemd-2.2.4/PKG-INFO
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gemd
|
|
3
|
+
Version: 2.2.4
|
|
4
|
+
Summary: Python binding for Citrine's GEMD data model
|
|
5
|
+
Author: Citrine Informatics
|
|
6
|
+
Project-URL: Homepage, http://github.com/CitrineInformatics/gemd-python
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Requires-Python: >=3.9
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: pint<0.25,>=0.24.4
|
|
17
|
+
Requires-Dist: deprecation<3,>=2.1.0
|
|
18
|
+
Requires-Dist: typing_extensions<5,>=4.8; python_version < "3.10"
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# GEMD-python
|
|
22
|
+
Python binding for Citrine's data model, GEMD.
|
|
23
|
+
|
|
24
|
+
This package provides a framework for storing information about the processes that create materials, the materials themselves, and measurements performed on those materials.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
To install `gemd`, you can simply:
|
|
29
|
+
```bash
|
|
30
|
+
$ pip install gemd
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Detailed documentation of the `GEMD` data model can be found in the [language-agnostic documentation](https://citrineinformatics.github.io/gemd-docs/).
|
|
34
|
+
Documentation of this package can be found [here](https://citrineinformatics.github.io/gemd-python/).
|
|
35
|
+
|
|
36
|
+
## Developer instructions
|
|
37
|
+
|
|
38
|
+
See the [contributing guide](./CONTRIBUTING.md).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.2.4"
|
|
@@ -45,7 +45,7 @@ __all__ = [
|
|
|
45
45
|
|
|
46
46
|
def import_table(filename=SMALL_TABLE):
|
|
47
47
|
"""Return the deserialized JSON table."""
|
|
48
|
-
from
|
|
48
|
+
from importlib.resources import files
|
|
49
49
|
import json
|
|
50
50
|
|
|
51
51
|
return json.loads(files("gemd.demo").joinpath(filename).read_text(encoding='utf-8'))
|
|
@@ -88,7 +88,9 @@ def array_like():
|
|
|
88
88
|
import numpy as np
|
|
89
89
|
try:
|
|
90
90
|
import pandas as pd
|
|
91
|
-
_array_like = (list, tuple, np.ndarray,
|
|
91
|
+
_array_like = (list, tuple, np.ndarray,
|
|
92
|
+
pd.core.base.PandasObject,
|
|
93
|
+
pd.api.extensions.ExtensionArray)
|
|
92
94
|
except ImportError: # pragma: no cover
|
|
93
95
|
_array_like = (list, tuple, np.ndarray) # pragma: no cover
|
|
94
96
|
except ImportError: # pragma: no cover
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
"""Implementation of units."""
|
|
2
2
|
from deprecation import deprecated
|
|
3
3
|
import functools
|
|
4
|
-
from
|
|
4
|
+
from importlib.resources import files
|
|
5
5
|
import os
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
import re
|
|
8
8
|
from tempfile import TemporaryDirectory
|
|
9
9
|
from typing import Union, List, Tuple, Generator, Any
|
|
10
|
+
try:
|
|
11
|
+
from typing import TypeAlias # Python 3.10+
|
|
12
|
+
except ImportError: # pragma nocover
|
|
13
|
+
from typing_extensions import TypeAlias # Python 3.9
|
|
10
14
|
|
|
11
15
|
from pint import UnitRegistry, register_unit_format
|
|
12
|
-
|
|
13
|
-
from pint.pint_eval import tokenizer
|
|
14
|
-
except ImportError: # pragma: no cover
|
|
15
|
-
from pint.compat import tokenizer
|
|
16
|
+
from pint.pint_eval import tokenizer
|
|
16
17
|
from tokenize import NAME, NUMBER, OP, ERRORTOKEN, TokenInfo
|
|
17
18
|
# alias the error that is thrown when units are incompatible
|
|
18
19
|
# this helps to isolate the dependence on pint
|
|
19
|
-
from pint.errors import DimensionalityError as IncompatibleUnitsError
|
|
20
|
-
from pint.errors import UndefinedUnitError, DefinitionSyntaxError
|
|
20
|
+
from pint.errors import DimensionalityError as IncompatibleUnitsError
|
|
21
|
+
from pint.errors import UndefinedUnitError, DefinitionSyntaxError
|
|
22
|
+
from pint.registry import GenericUnitRegistry
|
|
21
23
|
|
|
22
24
|
# Store directories so they don't get auto-cleaned until exit
|
|
23
25
|
_TEMP_DIRECTORY = TemporaryDirectory()
|
|
@@ -216,43 +218,29 @@ def _unmangle_scaling(input_string: str) -> str:
|
|
|
216
218
|
return input_string
|
|
217
219
|
|
|
218
220
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
# https://pint.readthedocs.io/en/0.23/advanced/custom-registry-class.html
|
|
222
|
-
from pint.registry import GenericUnitRegistry
|
|
223
|
-
from typing_extensions import TypeAlias
|
|
221
|
+
# Standard approach to creating a custom registry class:
|
|
222
|
+
# https://pint.readthedocs.io/en/0.23/advanced/custom-registry-class.html
|
|
224
223
|
|
|
225
|
-
|
|
226
|
-
|
|
224
|
+
class _ScaleFactorUnit(UnitRegistry.Unit):
|
|
225
|
+
"""Child class of Units for generating units w/ clean scaling factors."""
|
|
227
226
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
227
|
+
def __format__(self, format_spec):
|
|
228
|
+
result = super().__format__(format_spec)
|
|
229
|
+
return _unmangle_scaling(result)
|
|
231
230
|
|
|
232
|
-
class _ScaleFactorQuantity(UnitRegistry.Quantity):
|
|
233
|
-
"""Child class of Quantity for generating units w/ clean scaling factors."""
|
|
234
231
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
class _ScaleFactorRegistry(GenericUnitRegistry[_ScaleFactorQuantity, _ScaleFactorUnit]):
|
|
238
|
-
"""UnitRegistry class that uses _GemdUnits."""
|
|
232
|
+
class _ScaleFactorQuantity(UnitRegistry.Quantity):
|
|
233
|
+
"""Child class of Quantity for generating units w/ clean scaling factors."""
|
|
239
234
|
|
|
240
|
-
|
|
241
|
-
Unit: TypeAlias = _ScaleFactorUnit
|
|
235
|
+
pass
|
|
242
236
|
|
|
243
|
-
except ImportError: # pragma: no cover
|
|
244
|
-
# https://pint.readthedocs.io/en/0.21/advanced/custom-registry-class.html
|
|
245
|
-
class _ScaleFactorUnit(UnitRegistry.Unit):
|
|
246
|
-
"""Child class of Units for generating units w/ clean scaling factors."""
|
|
247
237
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
return _unmangle_scaling(result)
|
|
238
|
+
class _ScaleFactorRegistry(GenericUnitRegistry[_ScaleFactorQuantity, _ScaleFactorUnit]):
|
|
239
|
+
"""UnitRegistry class that uses _GemdUnits."""
|
|
251
240
|
|
|
252
|
-
|
|
253
|
-
|
|
241
|
+
Quantity: TypeAlias = _ScaleFactorQuantity
|
|
242
|
+
Unit: TypeAlias = _ScaleFactorUnit
|
|
254
243
|
|
|
255
|
-
_unit_class = _ScaleFactorUnit
|
|
256
244
|
|
|
257
245
|
_REGISTRY: _ScaleFactorRegistry = None # global requires it be defined in this scope
|
|
258
246
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gemd
|
|
3
|
+
Version: 2.2.4
|
|
4
|
+
Summary: Python binding for Citrine's GEMD data model
|
|
5
|
+
Author: Citrine Informatics
|
|
6
|
+
Project-URL: Homepage, http://github.com/CitrineInformatics/gemd-python
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Requires-Python: >=3.9
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: pint<0.25,>=0.24.4
|
|
17
|
+
Requires-Dist: deprecation<3,>=2.1.0
|
|
18
|
+
Requires-Dist: typing_extensions<5,>=4.8; python_version < "3.10"
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# GEMD-python
|
|
22
|
+
Python binding for Citrine's data model, GEMD.
|
|
23
|
+
|
|
24
|
+
This package provides a framework for storing information about the processes that create materials, the materials themselves, and measurements performed on those materials.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
To install `gemd`, you can simply:
|
|
29
|
+
```bash
|
|
30
|
+
$ pip install gemd
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Detailed documentation of the `GEMD` data model can be found in the [language-agnostic documentation](https://citrineinformatics.github.io/gemd-docs/).
|
|
34
|
+
Documentation of this package can be found [here](https://citrineinformatics.github.io/gemd-python/).
|
|
35
|
+
|
|
36
|
+
## Developer instructions
|
|
37
|
+
|
|
38
|
+
See the [contributing guide](./CONTRIBUTING.md).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
LICENSE
|
|
2
2
|
README.md
|
|
3
|
-
|
|
3
|
+
pyproject.toml
|
|
4
4
|
gemd/__init__.py
|
|
5
5
|
gemd/__version__.py
|
|
6
6
|
gemd.egg-info/PKG-INFO
|
|
@@ -108,8 +108,4 @@ gemd/units/constants_en.txt
|
|
|
108
108
|
gemd/units/impl.py
|
|
109
109
|
gemd/util/__init__.py
|
|
110
110
|
gemd/util/impl.py
|
|
111
|
-
tests/
|
|
112
|
-
tests/test_examples.py
|
|
113
|
-
tests/units/__init__.py
|
|
114
|
-
tests/units/test_parser.py
|
|
115
|
-
tests/units/test_units.txt
|
|
111
|
+
tests/test_examples.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
gemd
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "gemd"
|
|
3
|
+
dynamic = ["version"]
|
|
4
|
+
dependencies = [
|
|
5
|
+
"pint>=0.24.4,<0.25",
|
|
6
|
+
"deprecation>=2.1.0,<3",
|
|
7
|
+
"typing_extensions>=4.8,<5; python_version<'3.10'",
|
|
8
|
+
]
|
|
9
|
+
requires-python = ">=3.9"
|
|
10
|
+
authors = [
|
|
11
|
+
{name = "Citrine Informatics"}
|
|
12
|
+
]
|
|
13
|
+
description = "Python binding for Citrine's GEMD data model"
|
|
14
|
+
readme = "README.md"
|
|
15
|
+
license-files = ["LICENSE"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3.9",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "http://github.com/CitrineInformatics/gemd-python"
|
|
27
|
+
|
|
28
|
+
[build-system]
|
|
29
|
+
requires = ["setuptools>=75.0", "wheel"]
|
|
30
|
+
build-backend = "setuptools.build_meta"
|
|
31
|
+
|
|
32
|
+
[tool.setuptools.dynamic]
|
|
33
|
+
version = {attr = "gemd.__version__.__version__"}
|
|
34
|
+
|
|
35
|
+
[tool.setuptools.packages.find]
|
|
36
|
+
where = ["."]
|
|
37
|
+
include = ["gemd*"]
|
|
38
|
+
exclude = ["docs", "tests"]
|
|
39
|
+
|
|
40
|
+
[tool.setuptools.package-data]
|
|
41
|
+
"gemd.demo" = ["strehlow_and_cook.pif", "strehlow_and_cook_small.pif", "toothpick.jpg"]
|
|
42
|
+
"gemd.units" = ["citrine_en.txt", "constants_en.txt"]
|
|
43
|
+
"tests.units" = ["test_units.txt"]
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
[dependency-groups]
|
|
47
|
+
dev = [
|
|
48
|
+
"flake8==7.0.0",
|
|
49
|
+
"flake8-docstrings==1.7.0",
|
|
50
|
+
"numpy>=1.24.4; python_version<'3.10'",
|
|
51
|
+
"pandas>=2.0.3; python_version<'3.10'",
|
|
52
|
+
"numpy>=2.0.2,<3; python_version>='3.10'",
|
|
53
|
+
"pandas>=2.3.0,<4; python_version>='3.10'",
|
|
54
|
+
"pytest==8.4.2",
|
|
55
|
+
"pytest-cov==7.0.0",
|
|
56
|
+
"derp==0.1.1",
|
|
57
|
+
"tomli>=2.2.1",
|
|
58
|
+
]
|
|
59
|
+
docs = [
|
|
60
|
+
"sphinx==5.0.0",
|
|
61
|
+
"sphinx-rtd-theme==1.0.0",
|
|
62
|
+
"sphinxcontrib-apidoc==0.3.0",
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
[tool.pytest.ini_options]
|
|
66
|
+
testpaths = [
|
|
67
|
+
"tests",
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
[tool.coverage.run]
|
|
71
|
+
omit = [
|
|
72
|
+
"gemd/demo/*",
|
|
73
|
+
]
|
gemd-2.2.0/PKG-INFO
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: gemd
|
|
3
|
-
Version: 2.2.0
|
|
4
|
-
Summary: Python binding for Citrine's GEMD data model
|
|
5
|
-
Home-page: http://github.com/CitrineInformatics/gemd-python
|
|
6
|
-
Author: Citrine Informatics
|
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
|
8
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
-
Requires-Python: >=3.9
|
|
14
|
-
Provides-Extra: scripts
|
|
15
|
-
Provides-Extra: tests
|
|
16
|
-
Provides-Extra: tests.demo
|
|
17
|
-
Provides-Extra: tests.entity.bounds
|
|
18
|
-
License-File: LICENSE
|
gemd-2.2.0/gemd/__version__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.2.0"
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: gemd
|
|
3
|
-
Version: 2.2.0
|
|
4
|
-
Summary: Python binding for Citrine's GEMD data model
|
|
5
|
-
Home-page: http://github.com/CitrineInformatics/gemd-python
|
|
6
|
-
Author: Citrine Informatics
|
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
|
8
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
-
Requires-Python: >=3.9
|
|
14
|
-
Provides-Extra: scripts
|
|
15
|
-
Provides-Extra: tests
|
|
16
|
-
Provides-Extra: tests.demo
|
|
17
|
-
Provides-Extra: tests.entity.bounds
|
|
18
|
-
License-File: LICENSE
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
deprecation<3,>=2.1.0
|
|
2
|
-
importlib-resources<7,>=5.3
|
|
3
|
-
pint<0.25,>=0.24.4
|
|
4
|
-
typing_extensions<5,>=4.8
|
|
5
|
-
|
|
6
|
-
[scripts]
|
|
7
|
-
packaging
|
|
8
|
-
sphinx-rtd-theme==1.0.0
|
|
9
|
-
sphinx==5.0.0
|
|
10
|
-
sphinxcontrib-apidoc==0.3.0
|
|
11
|
-
|
|
12
|
-
[tests]
|
|
13
|
-
pytest<9,>=8.0.0
|
|
14
|
-
|
|
15
|
-
[tests.demo]
|
|
16
|
-
pandas<3,>=2.0.3
|
|
17
|
-
|
|
18
|
-
[tests.entity.bounds]
|
|
19
|
-
pandas<3,>=2.0.3
|
|
20
|
-
|
|
21
|
-
[tests.entity.bounds:python_version <= "3.10"]
|
|
22
|
-
numpy<2,>=1.24.4
|
gemd-2.2.0/setup.py
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
from setuptools import setup, find_packages
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
import re
|
|
4
|
-
|
|
5
|
-
packages = find_packages()
|
|
6
|
-
|
|
7
|
-
this_directory = Path(__file__).parent.absolute()
|
|
8
|
-
version_file = this_directory / 'gemd' / '__version__.py'
|
|
9
|
-
version_re = r'''^\s*__version__\s*=\s*(['"])([\w\.]+)\1$'''
|
|
10
|
-
if mo := re.search(version_re, version_file.read_text(), re.M):
|
|
11
|
-
version = mo.group(2)
|
|
12
|
-
else:
|
|
13
|
-
raise RuntimeError(f"Unable to find version string in {version_file}")
|
|
14
|
-
|
|
15
|
-
setup(name='gemd',
|
|
16
|
-
# Update this in gemd/__version__.py
|
|
17
|
-
version=version,
|
|
18
|
-
python_requires='>=3.9',
|
|
19
|
-
url='http://github.com/CitrineInformatics/gemd-python',
|
|
20
|
-
description="Python binding for Citrine's GEMD data model",
|
|
21
|
-
author='Citrine Informatics',
|
|
22
|
-
packages=packages,
|
|
23
|
-
package_data={
|
|
24
|
-
'gemd.demo': [
|
|
25
|
-
'strehlow_and_cook.pif',
|
|
26
|
-
'strehlow_and_cook_small.pif',
|
|
27
|
-
'toothpick.jpg'
|
|
28
|
-
],
|
|
29
|
-
'gemd.units': [
|
|
30
|
-
'citrine_en.txt',
|
|
31
|
-
'constants_en.txt',
|
|
32
|
-
],
|
|
33
|
-
'tests.units': ['test_units.txt']
|
|
34
|
-
},
|
|
35
|
-
install_requires=[
|
|
36
|
-
"pint>=0.24.4,<0.25",
|
|
37
|
-
"deprecation>=2.1.0,<3",
|
|
38
|
-
"typing_extensions>=4.8,<5",
|
|
39
|
-
"importlib-resources>=5.3,<7"
|
|
40
|
-
],
|
|
41
|
-
extras_require={
|
|
42
|
-
"scripts": [
|
|
43
|
-
"packaging",
|
|
44
|
-
"sphinx==5.0.0",
|
|
45
|
-
"sphinx-rtd-theme==1.0.0",
|
|
46
|
-
"sphinxcontrib-apidoc==0.3.0",
|
|
47
|
-
],
|
|
48
|
-
"tests": [
|
|
49
|
-
"pytest>=8.0.0,<9"
|
|
50
|
-
],
|
|
51
|
-
"tests.demo": [
|
|
52
|
-
"pandas>=2.0.3,<3"
|
|
53
|
-
],
|
|
54
|
-
"tests.entity.bounds": [
|
|
55
|
-
"numpy>=1.24.4,<2; python_version<='3.10'",
|
|
56
|
-
"pandas>=2.0.3,<3"
|
|
57
|
-
]
|
|
58
|
-
},
|
|
59
|
-
classifiers=[
|
|
60
|
-
'Programming Language :: Python :: 3',
|
|
61
|
-
'Programming Language :: Python :: 3.9',
|
|
62
|
-
'Programming Language :: Python :: 3.10',
|
|
63
|
-
'Programming Language :: Python :: 3.11',
|
|
64
|
-
'Programming Language :: Python :: 3.12',
|
|
65
|
-
'Programming Language :: Python :: 3.13',
|
|
66
|
-
],
|
|
67
|
-
)
|
gemd-2.2.0/tests/__init__.py
DELETED
|
File without changes
|
|
File without changes
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
from contextlib import contextmanager
|
|
2
|
-
from deprecation import DeprecatedWarning
|
|
3
|
-
from importlib_resources import files
|
|
4
|
-
import re
|
|
5
|
-
from pint import UnitRegistry
|
|
6
|
-
import pytest
|
|
7
|
-
|
|
8
|
-
from gemd.units import parse_units, convert_units, get_base_units, change_definitions_file, \
|
|
9
|
-
UndefinedUnitError, DefinitionSyntaxError, IncompatibleUnitsError
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@pytest.mark.parametrize("return_unit", [True, False])
|
|
13
|
-
def test_parse_expected(return_unit):
|
|
14
|
-
"""Test that we can parse the units that we expect to be able to."""
|
|
15
|
-
# Pint's parse_units actually gets this wrong
|
|
16
|
-
assert parse_units("m^-1 * newton / meter", return_unit=return_unit) == \
|
|
17
|
-
parse_units("N / m^2", return_unit=return_unit)
|
|
18
|
-
|
|
19
|
-
expected = [
|
|
20
|
-
"degC", "degF", "K",
|
|
21
|
-
"g", "kg", "mg", "ton",
|
|
22
|
-
"L", "mL",
|
|
23
|
-
"inch", "ft", "mm", "um",
|
|
24
|
-
"second", "ms", "hour", "minute", "ns",
|
|
25
|
-
"g/cm^3", "g/mL", "kg/cm^3",
|
|
26
|
-
"", "1",
|
|
27
|
-
"amu", # A line that was edited
|
|
28
|
-
"Seconds", # Added support for some title-case units
|
|
29
|
-
"delta_Celsius / hour", # Added to make sure pint version is right (>0.10)
|
|
30
|
-
"g / 2.5 cm", # Scaling factors are acceptable
|
|
31
|
-
"g / -+-25e-1 m", # Weird but fine
|
|
32
|
-
"ug / - -250 mL", # Spaces between unaries is acceptable
|
|
33
|
-
"1 / 10**5 degC", # Spaces between unaries is acceptable
|
|
34
|
-
"1 / 10_000 degC", # Spaces between unaries is acceptable
|
|
35
|
-
"m ** - 1", # Pint < 0.21 throws DefinitionSyntaxError
|
|
36
|
-
"gram / _10_minute", # Stringified Unit object SPT-1311
|
|
37
|
-
"gram / __1_2e_3minute", # Stringified Unit object SPT-1311
|
|
38
|
-
]
|
|
39
|
-
for unit in expected:
|
|
40
|
-
parsed = parse_units(unit, return_unit=return_unit)
|
|
41
|
-
assert parsed == parse_units(parsed, return_unit=return_unit)
|
|
42
|
-
assert parse_units("") == 'dimensionless'
|
|
43
|
-
# Scaling factors bind tightly to trailing units
|
|
44
|
-
scaling = [
|
|
45
|
-
("g / 2.5 cm", "g / (2.5 cm)"),
|
|
46
|
-
("g / 2.5cm", "g / (2.5 cm)"),
|
|
47
|
-
("g / 25.mm", "g / (25. mm)"),
|
|
48
|
-
("g / 2.5 * cm", "g cm / 2.5")
|
|
49
|
-
]
|
|
50
|
-
for left, right in scaling:
|
|
51
|
-
assert parse_units(left, return_unit=return_unit) == \
|
|
52
|
-
parse_units(right, return_unit=return_unit)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def test_parse_unexpected():
|
|
56
|
-
"""Test that we cannot parse the units that we do not expect to."""
|
|
57
|
-
unexpected = [
|
|
58
|
-
"gibberish",
|
|
59
|
-
5,
|
|
60
|
-
"cp", # Removed because of risk of collision with cP
|
|
61
|
-
"chain", # Survey units eliminated
|
|
62
|
-
"SECONDS", # Not just case insensitivity
|
|
63
|
-
"lb : in^3", # : is not a valid operator
|
|
64
|
-
]
|
|
65
|
-
for unit in unexpected:
|
|
66
|
-
with pytest.raises(UndefinedUnitError):
|
|
67
|
-
parse_units(unit)
|
|
68
|
-
|
|
69
|
-
scaling = [
|
|
70
|
-
"3 rpm", # No leading digits
|
|
71
|
-
"16", # No values that are just integers
|
|
72
|
-
"16.2" # No values that are just floats
|
|
73
|
-
"g * 0/ m", # Zero scaling factor
|
|
74
|
-
"F * 1.1 3.5", # numeric syntax error
|
|
75
|
-
"F m 1.1", # scale follows unit
|
|
76
|
-
"F * 1.1 ** 2", # numeric syntax error
|
|
77
|
-
]
|
|
78
|
-
for unit in scaling:
|
|
79
|
-
with pytest.raises(ValueError, match=r"[sS]caling"):
|
|
80
|
-
parse_units(unit)
|
|
81
|
-
|
|
82
|
-
definition = [
|
|
83
|
-
"/gram", # A leading operator makes no sense
|
|
84
|
-
]
|
|
85
|
-
for unit in definition:
|
|
86
|
-
with pytest.raises(DefinitionSyntaxError):
|
|
87
|
-
parse_units(unit)
|
|
88
|
-
|
|
89
|
-
zero_division = [
|
|
90
|
-
"g / 0 m", # Division by zero
|
|
91
|
-
]
|
|
92
|
-
for unit in zero_division:
|
|
93
|
-
with pytest.raises(ZeroDivisionError):
|
|
94
|
-
parse_units(unit)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
def test_parse_none():
|
|
98
|
-
"""Test that None parses as None."""
|
|
99
|
-
assert parse_units(None) is None
|
|
100
|
-
assert parse_units(None, return_unit=True) == parse_units("", return_unit=True)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
def test_parse_units_as_units():
|
|
104
|
-
"""Test that Units in == Units out."""
|
|
105
|
-
from gemd.units.impl import _REGISTRY
|
|
106
|
-
|
|
107
|
-
expected = [
|
|
108
|
-
_REGISTRY("kg").u,
|
|
109
|
-
]
|
|
110
|
-
for unit in expected:
|
|
111
|
-
parsed = parse_units(unit)
|
|
112
|
-
assert parsed == parse_units(parsed)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
def test_format():
|
|
116
|
-
"""Test that custom formatting behaves as we hope."""
|
|
117
|
-
# use the default unit registry for now
|
|
118
|
-
reg = UnitRegistry()
|
|
119
|
-
|
|
120
|
-
result = parse_units("K^-2.0 m^-1e0 C^0 g^1 s^2")
|
|
121
|
-
assert "-" not in result
|
|
122
|
-
assert "[time]" in str(reg(result).dimensionality)
|
|
123
|
-
assert "[current]" not in str(reg(result).dimensionality)
|
|
124
|
-
kelvin = str(reg("K").units)
|
|
125
|
-
gram = str(reg("g").units)
|
|
126
|
-
second = str(reg("s").units)
|
|
127
|
-
assert kelvin in str(result)
|
|
128
|
-
assert gram in str(result)
|
|
129
|
-
assert second in str(result)
|
|
130
|
-
assert result.index(gram) < result.index(kelvin)
|
|
131
|
-
assert result.index(gram) < result.index(second)
|
|
132
|
-
|
|
133
|
-
assert not re.search(r"\d", parse_units("m kg / s"))
|
|
134
|
-
assert "/" not in parse_units("m kg s")
|
|
135
|
-
assert "1" not in parse_units("s")
|
|
136
|
-
assert "1" in parse_units("s^-1")
|
|
137
|
-
assert "2.5" in parse_units("g / 2.5 cm")
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
def test_conversion():
|
|
141
|
-
"""Tests that check if particular units are interoperable."""
|
|
142
|
-
conversions = {"in_lb": "foot_pound"}
|
|
143
|
-
for source, dest in conversions.items():
|
|
144
|
-
assert convert_units(convert_units(1, source, dest), dest, source) == 1
|
|
145
|
-
|
|
146
|
-
# Verify that convert_units respects scaling factors
|
|
147
|
-
assert -1e-8 < convert_units(100, 'g / 100 mL', 'g/cc') - 1 < 1e-8
|
|
148
|
-
assert -1e-8 < convert_units(1, "g / 2.5 cm", "g / 25 mm") - 1 < 1e-8
|
|
149
|
-
|
|
150
|
-
# Verify that convert_units throws exceptions
|
|
151
|
-
with pytest.raises(IncompatibleUnitsError):
|
|
152
|
-
convert_units(1, 'mL', 'g')
|
|
153
|
-
with pytest.raises(IncompatibleUnitsError):
|
|
154
|
-
# https://pint.readthedocs.io/en/0.23/user/angular_frequency.html
|
|
155
|
-
convert_units(1, 'Hz', 'rpm')
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
def test_get_base_units():
|
|
159
|
-
"""Test that base units & conversions make sense."""
|
|
160
|
-
from gemd.units.impl import _REGISTRY
|
|
161
|
-
assert get_base_units("degC") == (_REGISTRY("kelvin"), 1, 273.15)
|
|
162
|
-
assert get_base_units("degC") == get_base_units(_REGISTRY("degC"))
|
|
163
|
-
assert get_base_units("km") == (_REGISTRY("meter"), 1000, 0)
|
|
164
|
-
assert get_base_units("g / 25 mm") == (_REGISTRY("kg / m"), 0.04, 0)
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
@contextmanager
|
|
168
|
-
def _change_units(filename):
|
|
169
|
-
try:
|
|
170
|
-
change_definitions_file(filename)
|
|
171
|
-
yield
|
|
172
|
-
finally:
|
|
173
|
-
change_definitions_file()
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
def test_file_change(tmpdir):
|
|
177
|
-
"""Test that swapping units files works."""
|
|
178
|
-
assert convert_units(1, 'm', 'cm') == 100
|
|
179
|
-
with pytest.raises(UndefinedUnitError):
|
|
180
|
-
assert convert_units(1, 'usd', 'USD') == 1
|
|
181
|
-
|
|
182
|
-
test_file = tmpdir / "test_units.txt"
|
|
183
|
-
test_file.write_binary(files("tests.units").joinpath("test_units.txt").read_bytes())
|
|
184
|
-
with _change_units(filename=test_file):
|
|
185
|
-
with pytest.raises(UndefinedUnitError):
|
|
186
|
-
assert convert_units(1, 'm', 'cm') == 100
|
|
187
|
-
assert convert_units(1, 'usd', 'USD') == 1
|
|
188
|
-
assert convert_units(1, 'm', 'cm') == 100 # And verify we're back to normal
|
|
189
|
-
with pytest.raises(UndefinedUnitError):
|
|
190
|
-
parse_units('mol : mol') # Ensure the preprocessor is still there
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
def test_punctuation():
|
|
194
|
-
"""Test that punctuation parses reasonably."""
|
|
195
|
-
assert parse_units('mol.') == parse_units('moles')
|
|
196
|
-
assert parse_units('N.m') == parse_units('N * m')
|
|
197
|
-
with pytest.raises(UndefinedUnitError):
|
|
198
|
-
parse_units('mol : mol')
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
def test_exponents():
|
|
202
|
-
"""SPT-874 fractional exponents were being treated as zero."""
|
|
203
|
-
megapascals = parse_units("MPa")
|
|
204
|
-
sqrt_megapascals = parse_units('MPa^0.5')
|
|
205
|
-
assert megapascals in sqrt_megapascals
|
|
206
|
-
assert sqrt_megapascals == parse_units(f"{megapascals} / {sqrt_megapascals}")
|
|
207
|
-
assert parse_units('MPa^1.5') == parse_units(f"{megapascals} * {sqrt_megapascals}")
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
def test__scientific_notation_preprocessor():
|
|
211
|
-
"""Verify that numbers are converted into scientific notation."""
|
|
212
|
-
assert "1e2 kilogram" in parse_units("F* 10 ** 2 kg")
|
|
213
|
-
assert "1e2 kg" in f'{parse_units("F* 10 ** 2 kg", return_unit=True):~}'
|
|
214
|
-
assert "1e-5" in parse_units("F* mm*10**-5")
|
|
215
|
-
assert "1e" not in parse_units("F* kg * 10 cm")
|
|
216
|
-
assert "-3.07e2" in parse_units("F* -3.07 * 10 ** 2")
|
|
217
|
-
assert "11e2" in parse_units("F* 11*10^2")
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
def test_deprecation():
|
|
221
|
-
"""Make sure deprecated things warn correctly."""
|
|
222
|
-
megapascals = parse_units("MPa", return_unit=True)
|
|
223
|
-
with pytest.warns(DeprecatedWarning):
|
|
224
|
-
stringified = f"{megapascals:clean}"
|
|
225
|
-
assert megapascals == parse_units(stringified, return_unit=False)
|
|
226
|
-
|
|
227
|
-
from pint import Quantity
|
|
228
|
-
with pytest.warns(DeprecatedWarning):
|
|
229
|
-
assert f"{Quantity('5 MPa'):clean}" == f"5 {stringified}"
|
|
230
|
-
|
|
231
|
-
from pint import Unit
|
|
232
|
-
with pytest.warns(DeprecatedWarning):
|
|
233
|
-
assert f"{Unit('MPa'):clean}" == stringified
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|