Skip to content

Commit 0b353de

Browse files
Andre Genslerfilak-sap
authored andcommitted
test: Added XML content that reproduces the bug.
fix: more robust handling of XML EntityType Property with empty attributes docs: Updated CHANGELOG.md
1 parent 98a6e88 commit 0b353de

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [Unreleased]
88

9+
- Fix Increased robustness when schema with empty properties is returned
910

1011
## [1.8.0]
1112

pyodata/v2/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1820,7 +1820,7 @@ def struct_type(self, value):
18201820

18211821
self._struct_type = value
18221822

1823-
if self._text_proprty_name is not None:
1823+
if self._text_proprty_name:
18241824
try:
18251825
self._text_proprty = self._struct_type.proprty(self._text_proprty_name)
18261826
except KeyError:

tests/metadata.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,14 @@
331331
<Property Name="City" Type="Edm.String" Nullable="true"/>
332332
</EntityType>
333333

334+
<EntityType Name="MaterialEntityWithEmptyString">
335+
<Key>
336+
<PropertyRef Name="ID"/>
337+
</Key>
338+
<Property Name="ID" Type="Edm.String" Nullable="false" sap:filterable="false" sap:updatable="false" sap:sortable="false"/>
339+
<Property Name="Material_Type" Type="Edm.String" MaxLength="20" sap:text="" sap:updatable="false" sap:label="Material branding"/>
340+
</EntityType>
341+
334342
<Association Name="AssociationEmployeeAddress">
335343
<End Type="EXAMPLE_SRV_SETS.Employee" Multiplicity="1" Role="EmployeeRole"/>
336344
<End Type="EXAMPLE_SRV_SETS.Address" Multiplicity="*" Role="AddressRole"/>

tests/test_model_v2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ def test_edmx(schema):
3232
'Customer',
3333
'Order',
3434
'EnumTest',
35-
'Enumeration'
35+
'Enumeration',
36+
'MaterialEntityWithEmptyString',
3637
}
3738

3839
assert set((entity_set.name for entity_set in schema.entity_sets)) == {

0 commit comments

Comments
 (0)