def test_complete(self): """ Test _complete property behavior """ obj = FUT(RIVAR, RDVAR, indep_min=0, indep_max=50) obj._indep_var = None assert not obj._complete obj = FUT(RIVAR, RDVAR, indep_min=0, indep_max=50) assert obj._complete
def test_indep_max(self, indep_max): """ Tests indep_max property behavior """ # __init__ path FUT(RIVAR, RDVAR, indep_max=indep_max) # Managed attribute path obj = FUT(RIVAR, RDVAR) obj.indep_max = indep_max assert obj.indep_max == indep_max
def test_indep_min(self, indep_min): """ Tests indep_min property behavior """ # __init__ path FUT(RIVAR, RDVAR, indep_min=indep_min) # Managed attribute path obj = FUT(RIVAR, RDVAR) obj.indep_min = indep_min assert obj.indep_min == indep_min
def test_indep_var(self): """ Tests indep_var property behavior """ # __init__ path indep_var1 = RIVAR indep_var2 = array([4.0, 5.0, 6.0]) assert (FUT(indep_var1, RDVAR).indep_var == indep_var1).all() assert (FUT(indep_var2, RDVAR).indep_var == indep_var2).all() # Managed attribute path obj = FUT(indep_var=indep_var1, dep_var=RDVAR) obj.indep_var = indep_var2 assert (obj.indep_var == indep_var2).all()
def test_dep_var(self): """ Tests dep_var property behavior """ # __init__ path # Valid values, these should not raise any exception indep_var = array([10, 20, 30]) dep_var1 = array([1, 2, 3]) dep_var2 = array([4.0, 5.0, 6.0]) assert (FUT(indep_var, dep_var1).dep_var == dep_var1).all() assert (FUT(indep_var, dep_var2).dep_var == dep_var2).all() # Managed attribute path obj = FUT(indep_var=indep_var, dep_var=dep_var1) obj.dep_var = dep_var1 assert (obj.dep_var == dep_var1).all() obj.dep_var = dep_var2 assert (obj.dep_var == dep_var2).all()
def test_indep_min_greater_than_indep_max_exceptions(self): """ Test behavior when indep_min and indep_max are incongruous """ # Assign indep_min first obj = FUT(RIVAR, RDVAR, indep_min=0.5) exmsg = 'Argument `indep_min` is greater than argument `indep_max`' APROP(obj, 'indep_max', 0, ValueError, exmsg) #with pytest.raises(ValueError) as excinfo: # obj.indep_max = 0 #assert GET_EXMSG(excinfo) == exmsg # Assign indep_max first obj = FUT(RIVAR, RDVAR) obj.indep_max = 40 APROP(obj, 'indep_min', 50, ValueError, exmsg)