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