@@ -113,6 +113,22 @@ def test_try_parse_int_value(string, expected_int):
113
113
assert int_attribute .value == expected_int
114
114
115
115
116
+ def test_error_parsing_attribute_has_none_value ():
117
+ int_attribute_name = "int_attribute"
118
+
119
+ attribute_list = create_single_attribute_list (
120
+ name = int_attribute_name ,
121
+ value = str .encode ("invalid_int" ),
122
+ anchors = None ,
123
+ content_type = Protobuf .CT_INT )
124
+
125
+ profile = Profile (attribute_list )
126
+
127
+ retrieved_string_attribute = profile .get_attribute (int_attribute_name )
128
+ assert retrieved_string_attribute .name == int_attribute_name
129
+ assert retrieved_string_attribute .value is None
130
+
131
+
116
132
def test_error_parsing_attribute_does_not_affect_other_attribute ():
117
133
string_attribute_name = "string_attribute"
118
134
int_attribute_name = "int_attribute"
@@ -134,14 +150,12 @@ def test_error_parsing_attribute_does_not_affect_other_attribute():
134
150
135
151
profile = Profile (attribute_list )
136
152
137
- assert len (profile .attributes ) == 1
153
+ assert len (profile .attributes ) == 2
138
154
139
155
retrieved_string_attribute = profile .get_attribute (string_attribute_name )
140
156
assert retrieved_string_attribute .name == string_attribute_name
141
157
assert retrieved_string_attribute .value == string_value
142
158
143
- assert profile .get_attribute (int_attribute_name ) is None
144
-
145
159
146
160
def test_try_parse_structured_postal_address_uk ():
147
161
structured_postal_address = {ADDRESS_FORMAT_KEY : ADDRESS_FORMAT_VALUE ,
0 commit comments