Esempio n. 1
0
 def get_random_data(self, c, tag=None):
     """Get a random bit of data conforming to the specified type tag."""
     if tag is None:
         t = hydrant.randType()
     else:
         t = T.parseTypeTag(tag)
     return hydrant.randValue(t)
Esempio n. 2
0
def test_parameters(dv):
    """Create a dataset with parameters"""
    dv.new('test', ['x', 'y'], ['z'])
    for i in xrange(100):
        t = hydrant.randType(noneOkay=False)
        a = hydrant.randValue(t)
        name = 'param{}'.format(i)
        dv.add_parameter(name, a)
        b = dv.get_parameter(name)
        flat_a = T.flatten(a)
        flat_b = T.flatten(b)
        assert flat_a == flat_b
Esempio n. 3
0
def add_params(dv):
    for i in range(100):
        t = hydrant.randType(noneOkay=False)
        v = hydrant.randValue(t)
        name = 'param{:04d}'.format(i)
        dv.add_parameter(name, v)