def test_no_unnecessary_exec_eval(): _c2a.value = 0 _c2b.value = 0 f2a() assert dds.eval(f2b) == "a11" assert dds.eval(f2b) == "a11" assert _c2b.value == 1
def test_2(): """ Authorized objects are taken into account """ global fun_2_obj assert dds.eval(fun_2_f1) is None fun_2_obj = 1 assert dds.eval(fun_2_f1) is None assert fun_2_counter.value == 2, fun_2_counter.value
def test_3(): """ Unauthorized objects are not taken into account """ global fun_3_obj assert dds.eval(fun_3_f1) is None fun_3_obj = UnsupportedOperation("b") assert dds.eval(fun_3_f1) is None assert fun_3_counter.value == 1, fun_3_counter.value
def test_args(): with pytest.raises(DDSException) as e: f2(3) assert e.value.error_code == DDSErrorCode.ARG_IN_DATA_FUNCTION with pytest.raises(DDSException) as e: dds.eval(f2_1) assert e.value.error_code == DDSErrorCode.ARG_IN_DATA_FUNCTION
def test_args(): # TODO: these tests are just checking that the calls are processed # They should also check that the function is not retriggered again. assert dds.keep(spath, fun_args, 1, 2) == 3 assert dds.keep(spath, fun_args, 1, b=2) == 3 assert dds.keep(spath, fun_args, a=1, b=2) == 3 assert dds.eval(fun_args_outer) == 3 assert dds.eval(fun_args, 1, 2) == 3 assert dds.eval(fun_args, a=1, b=2) == 3
def test(): assert f() == "a" assert _c.value == 1 assert dds.eval(f) == "a" assert _c.value == 1 assert f1() == "a" assert _c.value == 1 assert dds.eval(f1) == "a" assert _c.value == 1
def test(): fun() assert _c.value == 1 dds.keep(_p, f) assert _c.value == 1 dds.eval(f) assert _c.value == 1 dds.eval(f2) assert _c.value == 1
def test_4(): """ Authorized objects are taken into account """ global fun_4_obj assert dds.eval(fun_4_f) is None assert fun_4_counter1.value == 1 assert fun_4_counter2.value == 1 fun_4_obj = 1 assert dds.eval(fun_4_f) is None assert fun_4_counter1.value == 1 assert fun_4_counter2.value == 2
def test_5(): """ Chained calls are reevaluated """ global fun_5_obj assert dds.eval(fun_5_f) is None assert fun_5_counter1.value == 1 assert fun_5_counter2.value == 1 fun_5_obj = 1 assert dds.eval(fun_5_f) is None assert fun_5_counter1.value == 2 # This function comes later but has no argument -> no need to reevaluate assert fun_5_counter2.value == 1
def test(): fun1() assert _c.value == 1 fun2() assert _c.value == 1 dds.eval(fun2) assert _c.value == 1 fun3() assert _c.value == 2 dds.eval(fun3) assert _c.value == 2
def test_2_simple_eval(): _c2a.value = 0 _c2b.value = 0 assert f2() == "a11" assert _c2a.value == 1 assert _c2b.value == 1 assert dds.eval(f2) == "a11" assert _c2a.value == 1 assert _c2b.value == 1
def test_2(): assert dds.eval(f2_wrap) == "A"
def test_3(): assert dds.eval(fun_3, 3) == "A3"
def test(): assert dds.eval(fun) == function1() print(locals()) print(globals())
def test_1(): assert dds.eval(f2) == "A"
def test(): assert dds.eval(fun) == "a"
def test_sklearn(): """ Unauthorized objects are not taken into account """ dds.eval(pipeline) dds.eval(pipeline)
def test_8(): """ Using various objects does not cause an error """ assert dds.eval(fun_8_f1) is None
def test_exec_then_eval(): _c2a.value = 0 _c2b.value = 0 f2a() assert dds.eval(f2b) == "a11"
def test_kargs_2(): assert dds.eval(f2_1) == 3 assert dds.eval(f2_2) == 3
def test_gh140_biglists(): """ Using big objects throws an error """ # TODO: more comprehensive test on lists. They are still seen as external dependencies with pytest.raises(dds.DDSException) as e: dds.eval(fun_9) assert e.value.error_code == dds.structures.DDSErrorCode.SEQUENCE_TOO_LONG
def test_1(): """ Unauthorized objects do not trigger errors """ assert dds.eval(fun_1_f1) is None
def test_arrays(): assert len(dds.eval(f6)) == 0
y, test_size=0.2, random_state=42) clf = dds.keep("/wine-quality/my_model", build_model, X_train, y_train) stats = dds.keep("/wine-quality/my_model_stats.json", model_stats, clf, X_test, y_test) print("*** done ***") return stats dds.codecs.databricks.displayGraph(pipeline) # COMMAND ---------- dds.eval(pipeline) # COMMAND ---------- # MAGIC %md ## Load Artifacts from DDS # COMMAND ---------- dds.load("/wine-quality/my_model") # COMMAND ---------- dds.load("/wine-quality/my_model_stats.json")
def test_4(): assert dds.eval(f4_wrap) == "A12"
def test(): dds.eval(fun) assert _c.value == 1
def test_5(): assert dds.eval(f5_wrap) == "0" u.unreachable_var = 1 assert dds.eval(f5_wrap) == "0"
def test_gh131(): with pytest.raises(DDSException) as e: eval(f) assert e.value.error_code == DDSErrorCode.OVERLAPPING_PATH
def test_compare(): assert dds.eval(f_compare) == "True"
def test_kargs_1(): assert dds.eval(f1_1) == 6 assert dds.eval(f1_2) == 6