Ejemplo n.º 1
0
 class SomeSCO(stix2.v21._Observable):
     _type = "some-sco"
     _properties = OrderedDict((
         ('type', TypeProperty(_type, spec_version='2.1')),
         ('id', IDProperty(_type, spec_version='2.1')),
         (
             'extensions',
             ExtensionsProperty(
                 spec_version='2.1',
                 enclosing_type=_type,
             ),
         ),
         ('string', StringProperty()),
         ('int', IntegerProperty()),
         ('float', FloatProperty()),
         ('bool', BooleanProperty()),
         ('list', ListProperty(IntegerProperty())),
         ('dict', DictionaryProperty(spec_version="2.1")),
     ))
     _id_contributing_properties = [
         'string',
         'int',
         'float',
         'bool',
         'list',
         'dict',
     ]
Ejemplo n.º 2
0
def test_float_property_invalid(value):
    int_prop = FloatProperty()
    with pytest.raises(ValueError):
        int_prop.clean(value)
Ejemplo n.º 3
0
def test_float_property_valid(value):
    int_prop = FloatProperty()
    assert int_prop.clean(value) is not None