Пример #1
0
 def test_features(self):
     m = BSAmericanBinaryOption()
     assert m.features() == [
         "log_moneyness",
         "max_log_moneyness",
         "expiry_time",
         "volatility",
     ]
     _ = [get_feature(f) for f in m.features()]
Пример #2
0
def test_get_feature(feature):
    assert get_feature(str(feature)).__class__ == feature.__class__
    assert get_feature(feature).__class__ == feature.__class__
Пример #3
0
 def test_features(self):
     m = BSEuropeanOption()
     assert m.features() == ["log_moneyness", "expiry_time", "volatility"]
     _ = [get_feature(f) for f in m.features()]
Пример #4
0
def test_get_feature_error():
    with pytest.raises(ValueError):
        get_feature("nonexitent_feature")
    with pytest.raises(TypeError):
        get_feature(0)