Ejemplo n.º 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()]
Ejemplo n.º 2
0
def test_get_feature(feature):
    assert get_feature(str(feature)).__class__ == feature.__class__
    assert get_feature(feature).__class__ == feature.__class__
Ejemplo n.º 3
0
 def test_features(self):
     m = BSEuropeanOption()
     assert m.features() == ["log_moneyness", "expiry_time", "volatility"]
     _ = [get_feature(f) for f in m.features()]
Ejemplo n.º 4
0
def test_get_feature_error():
    with pytest.raises(ValueError):
        get_feature("nonexitent_feature")
    with pytest.raises(TypeError):
        get_feature(0)