def test_base_class_usage_with_handle(): handle = cuml.Handle() stream = cuml.cuda.Stream() handle.setStream(stream) base = cuml.Base(handle=handle) base.handle.sync() del base
def test_base_n_features_in(datatype, use_integer_n_features): X_train, _, _, _ = small_classification_dataset(datatype) integer_n_features = 8 clf = cuml.Base() if use_integer_n_features: clf._set_n_features_in(integer_n_features) assert clf.n_features_in_ == integer_n_features else: clf._set_n_features_in(X_train) assert clf.n_features_in_ == X_train.shape[1]
def test_base_class_usage(): # Ensure base class returns the 3 main properties needed by all classes base = cuml.Base() base.handle.sync() base_params = base.get_param_names() assert "handle" in base_params assert "verbose" in base_params assert "output_type" in base_params del base
def test_base_hasattr(): base = cuml.Base() # With __getattr__ overriding magic, hasattr should still return # True only for valid attributes assert hasattr(base, "handle") assert not hasattr(base, "somefakeattr")
def test_base_class_usage(): base = cuml.Base() base.handle.sync() base_params = base.get_param_names() assert base_params == [] del base
def test_base_class_usage_with_handle(): stream = Stream() handle = cuml.Handle(stream=stream) base = cuml.Base(handle=handle) base.handle.sync() del base