-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b1218aa
commit d5b9b3c
Showing
2 changed files
with
102 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from festim import RadioactiveDecay | ||
import pytest | ||
|
||
|
||
def test_init(): | ||
rd = RadioactiveDecay(0.5, 100) | ||
assert rd.decay_constant == 0.5 | ||
assert rd.volume == 100 | ||
|
||
|
||
def test_decay_constant_setter(): | ||
rd = RadioactiveDecay(0.5, 100) | ||
rd.decay_constant = 0.7 | ||
assert rd.decay_constant == 0.7 | ||
|
||
|
||
def test_decay_constant_setter_invalid_type(): | ||
rd = RadioactiveDecay(0.5, 100) | ||
with pytest.raises(TypeError): | ||
rd.decay_constant = "invalid" | ||
|
||
|
||
def test_decay_constant_setter_negative_value(): | ||
rd = RadioactiveDecay(0.5, 100) | ||
with pytest.raises(ValueError): | ||
rd.decay_constant = -0.5 | ||
|
||
|
||
def test_form(): | ||
rd = RadioactiveDecay(0.5, 100) | ||
assert rd.form(200) == -100 |