Accepting request 1290776 from devel:languages:python:numeric
- update to 1.26:
* version 1.26, 2024-11-26 -- update to latest CODATA (and add
CODATA URLs), add debye unit of dyipole moment, add
README_appendix about how to do parallel processing,
modernize build / packaging
OBS-URL: https://build.opensuse.org/request/show/1290776
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-numericalunits?expand=0&rev=8
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c32a482adae818a1a8d6c799bf9fb153326461d490c0de9deab9c694a6537eec
|
||||
size 16027
|
||||
3
numericalunits-1.26.tar.gz
Normal file
3
numericalunits-1.26.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8a0b69945dd65eacf6eef8c868bcd3298d7439f5882f507bb6060ec20c723e12
|
||||
size 18263
|
||||
@@ -1,3 +1,12 @@
|
||||
-------------------------------------------------------------------
|
||||
Sat Jul 5 10:51:28 UTC 2025 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
- update to 1.26:
|
||||
* version 1.26, 2024-11-26 -- update to latest CODATA (and add
|
||||
CODATA URLs), add debye unit of dyipole moment, add
|
||||
README_appendix about how to do parallel processing,
|
||||
modernize build / packaging
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri May 9 05:12:15 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
Name: python-numericalunits
|
||||
Version: 1.25
|
||||
Version: 1.26
|
||||
Release: 0
|
||||
Summary: Python module for defining quantities with units
|
||||
License: MIT
|
||||
|
||||
19
tests.py
19
tests.py
@@ -4,32 +4,33 @@ very basic tests on numericalunits
|
||||
"""
|
||||
import unittest
|
||||
import numericalunits as nu
|
||||
from math import isclose
|
||||
|
||||
class TestStuff(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def assert_almost_equal(self, a, b, rtol):
|
||||
"""helper function to check if two floats are approximately equal,
|
||||
allowing for rounding errors etc. Similar to math.isclose in py3."""
|
||||
self.assertTrue(abs(a-b) <= rtol * (abs(a) + abs(b)))
|
||||
|
||||
def test_everything(self):
|
||||
"""just some very basic smoke tests"""
|
||||
# example from README
|
||||
x = 5 * nu.mL
|
||||
self.assert_almost_equal(x, 5e21 * nu.nm**3, rtol=1e-9)
|
||||
self.assertTrue(isclose(5 * nu.mL, 5e21 * nu.nm**3, rel_tol=1e-9))
|
||||
|
||||
# example from README
|
||||
Efield = 1e5 * (nu.V / nu.cm)
|
||||
force = nu.e * Efield
|
||||
accel = force / nu.me
|
||||
self.assert_almost_equal(accel, 1.75882002e18 * nu.m / nu.s**2, rtol=1e-6)
|
||||
self.assertTrue(isclose(accel, 1.75882002e18 * nu.m / nu.s**2, rel_tol=1e-6))
|
||||
|
||||
# check nu_eval()
|
||||
self.assertTrue(isclose(nu.nu_eval('kg'), nu.kg, rel_tol=1e-9))
|
||||
self.assertTrue(isclose(nu.nu_eval('kg * m / s**2'), nu.kg * nu.m / nu.s**2, rel_tol=1e-9))
|
||||
self.assertTrue(isclose(nu.nu_eval('kg**-3.6'), nu.kg**-3.6, rel_tol=1e-9))
|
||||
|
||||
# make sure reset_units('SI') works
|
||||
nu.reset_units('SI')
|
||||
self.assert_almost_equal(nu.G, 1e-4, rtol=1e-9)
|
||||
self.assertTrue(isclose(nu.G, 1e-4, rel_tol=1e-9))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user