Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
1f0e141b
Commit
1f0e141b
authored
Jun 23, 2015
by
peastman
Browse files
Merge pull request #985 from swails/bool_unit
Fix Python 3 support in unit package.
parents
96f0c0f2
24f6585e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
3 deletions
+2
-3
wrappers/python/simtk/unit/quantity.py
wrappers/python/simtk/unit/quantity.py
+1
-2
wrappers/python/tests/TestUnits.py
wrappers/python/tests/TestUnits.py
+1
-1
No files found.
wrappers/python/simtk/unit/quantity.py
View file @
1f0e141b
...
...
@@ -603,7 +603,7 @@ class Quantity(object):
return
bool
(
self
.
_value
)
def
__bool__
(
self
):
return
self
.
_
_nonzero__
(
)
return
bool
(
self
.
_
value
)
def
__complex__
(
self
):
return
Quantity
(
complex
(
self
.
_value
),
self
.
unit
)
...
...
@@ -818,7 +818,6 @@ def _is_string(x):
except
StopIteration
:
return
False
# run module directly for testing
if
__name__
==
'__main__'
:
# Test the examples in the docstrings
...
...
wrappers/python/tests/TestUnits.py
View file @
1f0e141b
...
...
@@ -448,7 +448,7 @@ class TestUnits(QuantityTestCase):
self
.
assertAlmostEqualQuantities
(
n
,
2.05834818672e-17
*
u
.
mole
)
self
.
assertAlmostEqualQuantities
(
V
,
5.2359833333333e-19
*
u
.
meters
**
3
)
self
.
assertEqual
(
str
(
T
),
'310.0 K'
)
self
.
assertEqual
(
str
(
u
.
MOLAR_GAS_CONSTANT_R
),
'8.31447247122
J/(K mol)'
)
self
.
assertEqual
(
str
(
1
*
u
.
joules
/
u
.
kelvin
/
u
.
mole
),
'1
J/(K mol)'
)
self
.
assertTrue
(
u
.
is_quantity
(
V
))
# Checks trouble with complicated unit conversion factors
p1
=
1.0
*
u
.
atmospheres
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment