def __init__(self): """ UVBase test object. """ # add some test UVParameters to the class self._int1 = uvp.UVParameter( "int1", description="integer value", expected_type=int, value=3 ) self._int2 = uvp.UVParameter( "int2", description="integer value", expected_type=int, value=5 ) self._float1 = uvp.UVParameter( "float1", description="float value", expected_type=np.float, value=18.2 ) self._string1 = uvp.UVParameter( "string1", description="string value", form="str", value="test" ) self._string2 = uvp.UVParameter( "string2", description="string value", expected_type="str", value="test" ) self._floatarr = uvp.UVParameter( "floatarr", description="float array", form=("int1", "int2"), expected_type=np.float, value=np.random.rand(self._int1.value, self._int2.value), ) self._floatarr2 = uvp.UVParameter( "floatarr2", description="float array", form=4, expected_type=np.float, value=np.random.rand(4), ) self._strlist = uvp.UVParameter( "strlist", description="string list", form=("int1",), expected_type=str, value=["s" + str(i) for i in np.arange(self._int1.value)], ) self._intlist = uvp.UVParameter( "intlist", description="integer list", form=("int1",), expected_type=int, value=list(range(self._int1.value)), ) self._angle = uvp.AngleParameter( "angle", description="angle", expected_type=np.float, value=np.pi / 4.0 ) self._location = uvp.LocationParameter( "location", description="location", value=np.array(ref_xyz) ) self._optional_int1 = uvp.UVParameter( "optional_int1", description="optional integer value", expected_type=int, value=3, required=False, ) self._optional_int2 = uvp.UVParameter( "optional_int2", description="optional integer value", expected_type=int, value=5, required=False, ) self._unset_int1 = uvp.UVParameter( "unset_int1", description="An unset parameter.", expected_type=int, value=None, required=False, ) super(UVTest, self).__init__()
def test_class_inequality(): """Test equality error for different uvparameter classes.""" param1 = uvp.UVParameter(name='p1', value=1) param2 = uvp.AngleParameter(name='p2', value=1) nt.assert_not_equal(param1, param2)
def test_class_inequality(): """Test equality error for different uvparameter classes.""" param1 = uvp.UVParameter(name="p1", value=1) param2 = uvp.AngleParameter(name="p2", value=1) assert param1 != param2
def test_angle_set_degree_none(): param1 = uvp.AngleParameter(name="p2", value=1) param1.set_degrees(None) assert param1.value is None
def __init__(self): """ UVBase test object. """ # add some test UVParameters to the class self._int1 = uvp.UVParameter('int1', description='integer value', expected_type=int, value=3) self._int2 = uvp.UVParameter('int2', description='integer value', expected_type=int, value=5) self._float1 = uvp.UVParameter('float1', description='float value', expected_type=np.float, value=18.2) self._string1 = uvp.UVParameter('string1', description='string value', form='str', value='test') self._string2 = uvp.UVParameter('string2', description='string value', expected_type='str', value='test') self._floatarr = uvp.UVParameter('floatarr', description='float array', form=('int1', 'int2'), expected_type=np.float, value=np.random.rand( self._int1.value, self._int2.value)) self._floatarr2 = uvp.UVParameter('floatarr2', description='float array', form=4, expected_type=np.float, value=np.random.rand(4)) self._strlist = uvp.UVParameter( 'strlist', description='string list', form=('int1', ), expected_type=str, value=['s' + str(i) for i in np.arange(self._int1.value)]) self._intlist = uvp.UVParameter('intlist', description='integer list', form=('int1', ), expected_type=int, value=list(range(self._int1.value))) self._angle = uvp.AngleParameter('angle', description='angle', expected_type=np.float, value=np.pi / 4.) self._location = uvp.LocationParameter('location', description='location', value=np.array(ref_xyz)) self._optional_int1 = uvp.UVParameter( 'optional_int1', description='optional integer value', expected_type=int, value=3, required=False) self._optional_int2 = uvp.UVParameter( 'optional_int2', description='optional integer value', expected_type=int, value=5, required=False) super(UVTest, self).__init__()