Skip to content

Commit

Permalink
Adding test for new convert_unit
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaushik Malapati authored and Kaushik Malapati committed Oct 24, 2024
1 parent 52be91a commit d879ca9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ API Breaks

Library Features
----------------
- Added the ability to add custom units for convert_unit
- Added the ability to add custom units for convert_unit with a unit test

Device Features
---------------
Expand Down
10 changes: 10 additions & 0 deletions pcdsdevices/tests/test_units.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from ..utils import convert_unit


def test_convert_unit():
assert convert_unit(0.5, 'J', 'mJ') == 500
assert convert_unit(2, 'J', 'uJ') == 2000000
assert convert_unit(1, 'mJ', 'J') == 0.001
assert convert_unit(0.1, 'mJ', 'uJ') == 100
assert convert_unit(1000, 'uJ', 'J') == 0.001
assert convert_unit(10, 'uJ', 'mJ') == 0.01

0 comments on commit d879ca9

Please sign in to comment.