Skip to main content

assert_true

assert_true()

Asserts that a condition is true. This assertion can be used with Layer dataset and model entities.

  • Parameters

    assert_function (Callable[[...], bool**]) -- Test function with a boolean return type.

  • Returns

    Function object.

  • Return type

    Callable[[...], Any]

from layer.decorators.assertions import assert_true
from layer.decorators import dataset

def test_function(data_frame):
return len(data_frame.index) == 0

@dataset("empty-data")
@assert_true(test_function)
def create_my_dataset():
return pandas.DataFrame()