From 821e9b13af54ca8aba2a975c65e6e141b1daafc1 Mon Sep 17 00:00:00 2001 From: Harshal Pohekar <106588300+hpohekar@users.noreply.github.com> Date: Mon, 12 Aug 2024 10:21:54 +0530 Subject: [PATCH 1/2] fix: Update temperature conversion factor (#287) * fix: Update temprature conversion factor * fix: Add test * fix: Update test --- src/ansys/units/cfg.yaml | 8 ++++---- tests/test_quantity.py | 10 +++++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/ansys/units/cfg.yaml b/src/ansys/units/cfg.yaml index 63a9950c..83394fe3 100644 --- a/src/ansys/units/cfg.yaml +++ b/src/ansys/units/cfg.yaml @@ -168,11 +168,11 @@ base_units: si_offset: 273.15 F: type: TEMPERATURE - si_scaling_factor: 0.55555555555 + si_scaling_factor: 0.5555555555555555 si_offset: 459.67 R: type: TEMPERATURE - si_scaling_factor: 0.55555555555 + si_scaling_factor: 0.5555555555555555 si_offset: 0 delta_K: type: TEMPERATURE_DIFFERENCE @@ -184,11 +184,11 @@ base_units: si_offset: 0 delta_F: type: TEMPERATURE_DIFFERENCE - si_scaling_factor: 0.55555555555 + si_scaling_factor: 0.5555555555555555 si_offset: 0 delta_R: type: TEMPERATURE_DIFFERENCE - si_scaling_factor: 0.55555555555 + si_scaling_factor: 0.5555555555555555 si_offset: 0 # Derived Units diff --git a/tests/test_quantity.py b/tests/test_quantity.py index ec052e3b..50ea6501 100644 --- a/tests/test_quantity.py +++ b/tests/test_quantity.py @@ -281,7 +281,7 @@ def test_temp_subtraction(): t5 = Quantity(10.0, "delta_F") t6 = t5 - t4 - assert t6 == Quantity(-25.60000000495262, "F") + assert t6 == Quantity(-25.600000000000023, "F") def test_pow(): @@ -668,3 +668,11 @@ def test_error_messages(): def test_value_as_string(): with pytest.raises(TypeError): q = Quantity("string", "m") + + +def test_C_to_F(): + ureg = UnitRegistry() + five_c = Quantity(value=5.0, units=ureg.C) + converted = five_c.to(ureg.F) + assert converted.value == 41.0 + assert converted.units._name == "F" From 93b1f01097c0afa897578bded62b4a7b7a8fb17e Mon Sep 17 00:00:00 2001 From: Harshal Pohekar <106588300+hpohekar@users.noreply.github.com> Date: Mon, 12 Aug 2024 13:59:53 +0530 Subject: [PATCH 2/2] fix: Drop support for Python 3.9 (#289) --- .github/workflows/ci_cd.yml | 6 +++--- README.rst | 2 +- doc/source/getting_started/installation.rst | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 96226c35..73d9b4c1 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -14,7 +14,7 @@ concurrency: cancel-in-progress: true env: - MAIN_PYTHON_VERSION: '3.9' + MAIN_PYTHON_VERSION: '3.10' DOCUMENTATION_CNAME: 'units.docs.pyansys.com' LIBRARY_NAME: 'ansys-units' LIBRARY_NAMESPACE: 'ansys.units' @@ -61,7 +61,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] - python-version: ['3.9', '3.10', '3.11'] + python-version: ['3.10', '3.11', '3.12'] steps: - uses: ansys/actions/build-wheelhouse@v5.1 with: @@ -76,7 +76,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.9', '3.10', '3.11'] + python-version: ['3.10', '3.11', '3.12'] fail-fast: false steps: - uses: ansys/actions/tests-pytest@v5.1 diff --git a/README.rst b/README.rst index 85365445..370ef3c6 100644 --- a/README.rst +++ b/README.rst @@ -69,7 +69,7 @@ To reach the project support team, email `pyansys.core@ansys.com