You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.2 KiB
Python
52 lines
1.2 KiB
Python
import pytest
|
|
from src.aeros_equipment.service import get_distribution
|
|
|
|
def test_get_distribution_weibull_2p():
|
|
item = {
|
|
"distribution": "Weibull-2P",
|
|
"parameters": {
|
|
"beta": 2.5,
|
|
"alpha": 1000
|
|
}
|
|
}
|
|
dist_type, p1, p2 = get_distribution(item)
|
|
assert dist_type == "Weibull2"
|
|
assert p1 == 2.5
|
|
assert p2 == 1000
|
|
|
|
def test_get_distribution_exponential_2p():
|
|
item = {
|
|
"distribution": "Exponential-2P",
|
|
"parameters": {
|
|
"Lambda": 0.01,
|
|
"gamma": 100
|
|
}
|
|
}
|
|
dist_type, p1, p2 = get_distribution(item)
|
|
assert dist_type == "Exponential2"
|
|
assert p1 == 0.01
|
|
assert p2 == 100
|
|
|
|
def test_get_distribution_nhpp():
|
|
item = {
|
|
"distribution": "NHPP",
|
|
"parameters": {
|
|
"beta": 0.5,
|
|
"eta": 5000
|
|
}
|
|
}
|
|
dist_type, p1, p2 = get_distribution(item)
|
|
assert dist_type == "NHPPTTFF"
|
|
assert p1 == 0.5
|
|
assert p2 == 5000
|
|
|
|
def test_get_distribution_default():
|
|
item = {
|
|
"distribution": "Unknown",
|
|
"parameters": {}
|
|
}
|
|
dist_type, p1, p2 = get_distribution(item)
|
|
assert dist_type == "NHPPTTFF"
|
|
assert p1 == 1
|
|
assert p2 == 100000
|