Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge pull request #3 from enthought/offset_units_patch
patch from user John Lund - include offset functionality in all units by default. deprecate use of scimath.units.smart_unit.OffsetUnit
- Loading branch information
Showing
7 changed files
with
44 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,29 @@ | ||
import unittest | ||
|
||
from traits.testing.api import doctest_for_module | ||
|
||
import scimath.units.unit_scalar as unit_scalar | ||
from scimath.units.unit_scalar import UnitScalar | ||
from scimath.units.length import m | ||
from scimath.units.unit import unit | ||
|
||
|
||
from nose.tools import assert_equal, assert_is_instance | ||
|
||
class UnitScalarDocTestCase(doctest_for_module(unit_scalar)): | ||
pass | ||
|
||
|
||
def test_offset_unit_computations(): | ||
""" Executing some basic computations with a basic custom unit with offset. | ||
""" | ||
my_u = unit(12, m.derivation, 14) | ||
s1 = UnitScalar(3, units=my_u) | ||
s2 = UnitScalar(5, units=my_u) | ||
s3 = s1+s2 | ||
assert_equal(s3,UnitScalar(8, units=my_u)) | ||
|
||
|
||
|
||
if __name__ == '__main__': | ||
import sys | ||
unittest.main(argv=sys.argv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters