From 53dbc5835e682ce561667cf4c7e2f7753338e9fd Mon Sep 17 00:00:00 2001 From: Chris Lenk Date: Wed, 1 Jul 2020 09:54:50 -0400 Subject: [PATCH] Add test for coverage Tests creating a property with both required and default. --- stix2/test/test_properties.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/stix2/test/test_properties.py b/stix2/test/test_properties.py index a129b12..dab713e 100644 --- a/stix2/test/test_properties.py +++ b/stix2/test/test_properties.py @@ -4,7 +4,7 @@ import pytest import pytz import stix2 -from stix2.exceptions import ExtraPropertiesError +from stix2.exceptions import ExtraPropertiesError, STIXError from stix2.properties import ( BinaryProperty, BooleanProperty, EmbeddedObjectProperty, EnumProperty, FloatProperty, HexProperty, IntegerProperty, ListProperty, Property, @@ -47,7 +47,7 @@ def test_property_default(): assert p.default() == 77 -def test_fixed_property(): +def test_property_fixed(): p = Property(fixed="2.0") assert p.clean("2.0") @@ -60,6 +60,11 @@ def test_fixed_property(): assert p.clean(p.default()) +def test_property_fixed_and_required(): + with pytest.raises(STIXError): + Property(default=lambda: 3, required=True) + + def test_list_property(): p = ListProperty(StringProperty)