Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Configure angle as dimension #309

Merged
merged 41 commits into from
Nov 7, 2024
Merged
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
4d4b86a
feat: Remove angle as dimension
hpohekar Nov 5, 2024
9556b7d
feat: Remove angle as dimension 1
hpohekar Nov 5, 2024
1362d5b
feat: Support Python 3.13
hpohekar Nov 5, 2024
4a46495
feat: example fix
hpohekar Nov 5, 2024
bb3c1bf
feat: configure angle
hpohekar Nov 5, 2024
a1a3c22
feat: configure angle 1
hpohekar Nov 5, 2024
e8a2730
feat: test update 1
hpohekar Nov 5, 2024
36783df
feat: test update 2
hpohekar Nov 5, 2024
05cd020
feat: test update 3
hpohekar Nov 5, 2024
751ec36
feat: test update 4
hpohekar Nov 5, 2024
da3fe17
feat: test update 5
hpohekar Nov 5, 2024
8f75f05
feat: test update 6
hpohekar Nov 5, 2024
fb4cb48
feat: test update 7
hpohekar Nov 5, 2024
30f20fe
feat: test update 8
hpohekar Nov 5, 2024
1204aab
feat: test update 9
hpohekar Nov 5, 2024
b83d182
feat: test update 10
hpohekar Nov 5, 2024
63af28b
feat: test update 11
hpohekar Nov 5, 2024
36ba7c4
feat: test update 12
hpohekar Nov 5, 2024
fd1315a
feat: test update 13
hpohekar Nov 5, 2024
10b02fa
feat: test update 14
hpohekar Nov 5, 2024
7cb8044
feat: test update 15
hpohekar Nov 5, 2024
5ce4abe
feat: test update 16
hpohekar Nov 5, 2024
f289311
feat: test update 17
hpohekar Nov 5, 2024
7d086d0
feat: test update 18
hpohekar Nov 5, 2024
6bb2819
feat: Contributors
hpohekar Nov 5, 2024
8ab140e
feat: refactoring 1
hpohekar Nov 5, 2024
51e988d
feat: refactoring 2
hpohekar Nov 5, 2024
54952f0
feat: refactoring 3
hpohekar Nov 5, 2024
72b68bb
feat: refactoring 4
hpohekar Nov 5, 2024
2e253cf
feat: refactoring 5
hpohekar Nov 6, 2024
0247775
feat: refactoring 6
hpohekar Nov 6, 2024
a3a00c1
feat: refactoring 7
hpohekar Nov 6, 2024
50e3c94
feat: refactoring 8
hpohekar Nov 6, 2024
9b8b6a0
feat: test fix 1
hpohekar Nov 6, 2024
9166bbd
feat: test fix 2
hpohekar Nov 6, 2024
fb31f20
feat: test fix 3
hpohekar Nov 6, 2024
d398625
remove maintenance changes
hpohekar Nov 6, 2024
0135640
Merge branch 'main' into feat/configure_angles_as_dimensions
hpohekar Nov 7, 2024
28a61cf
add more tests
hpohekar Nov 7, 2024
79060b3
Merge branch 'feat/configure_angles_as_dimensions' of https://github.…
hpohekar Nov 7, 2024
907c371
update license
hpohekar Nov 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: test update 6
hpohekar committed Nov 5, 2024
commit 8f75f055b6e6b3c6f8f01312ed4c0e4ecb257462
18 changes: 18 additions & 0 deletions tests/test_systems.py
Original file line number Diff line number Diff line change
@@ -20,8 +20,12 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import os

import pytest

os.environ["PYANSYS_UNITS_ANGLE_AS_DIMENSION"] = "1"

from ansys.units import BaseDimensions, UnitRegistry, UnitSystem
from ansys.units.systems import IncorrectUnitType, InvalidUnitSystem, NotBaseUnit

@@ -33,9 +37,11 @@ def test_pre_defined_unit_system():
assert us.TIME == "s"
assert us.TEMPERATURE == "K"
assert us.TEMPERATURE_DIFFERENCE == "delta_K"
assert us.ANGLE == "radian"
assert us.CHEMICAL_AMOUNT == "mol"
assert us.LIGHT == "cd"
assert us.CURRENT == "A"
assert us.SOLID_ANGLE == "sr"


def test_repr():
@@ -48,6 +54,8 @@ def test_repr():
CHEMICAL_AMOUNT: mol
LIGHT: cd
CURRENT: A
ANGLE: radian
SOLID_ANGLE: sr
"""

assert repr(us) == str(us_dict)
@@ -69,19 +77,23 @@ def test_update():
dims.TIME: "s",
dims.TEMPERATURE: "R",
dims.TEMPERATURE_DIFFERENCE: "delta_R",
dims.ANGLE: "degree",
dims.CHEMICAL_AMOUNT: ureg.slugmol,
dims.LIGHT: "cd",
dims.CURRENT: "A",
dims.SOLID_ANGLE: "sr",
}
us.update(base_units=base_units)
assert us.MASS.name == "slug"
assert us.LENGTH.name == "ft"
assert us.TIME == "s"
assert us.TEMPERATURE == "R"
assert us.TEMPERATURE_DIFFERENCE == "delta_R"
assert us.ANGLE == "degree"
assert us.CHEMICAL_AMOUNT.name == "slugmol"
assert us.LIGHT == "cd"
assert us.CURRENT == "A"
assert us.SOLID_ANGLE == "sr"


def test_eq():
@@ -118,19 +130,23 @@ def test_custom_unit_system():
dims.TIME: "s",
dims.TEMPERATURE: "R",
dims.TEMPERATURE_DIFFERENCE: "delta_R",
dims.ANGLE: "radian",
dims.CHEMICAL_AMOUNT: "slugmol",
dims.LIGHT: "cd",
dims.CURRENT: "A",
dims.SOLID_ANGLE: "sr",
}
)
assert us.MASS == "slug"
assert us.LENGTH == "ft"
assert us.TIME == "s"
assert us.TEMPERATURE == "R"
assert us.TEMPERATURE_DIFFERENCE == "delta_R"
assert us.ANGLE == "radian"
assert us.CHEMICAL_AMOUNT == "slugmol"
assert us.LIGHT == "cd"
assert us.CURRENT == "A"
assert us.SOLID_ANGLE == "sr"


def test_not_base_unit_init():
@@ -163,6 +179,8 @@ def test_wrong_unit_type():
us.LIGHT = "sr"
with pytest.raises(IncorrectUnitType):
us.CURRENT = "ft"
with pytest.raises(IncorrectUnitType):
us.SOLID_ANGLE = "radian"


def test_error_messages():