Пример #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',
     ]
Пример #2
0
def test_float_property_invalid(value):
    int_prop = FloatProperty()
    with pytest.raises(ValueError):
        int_prop.clean(value)
Пример #3
0
def test_float_property_valid(value):
    int_prop = FloatProperty()
    assert int_prop.clean(value) is not None