Skip to content

Commit

Permalink
test/trac-0193: correct test
Browse files Browse the repository at this point in the history
The original solution fixed the exception when bindings were generated,
but the test passed only because of issue pabigot#78 which took four years more
to discover.  Revise the test to more accurately reflect what the
original fix enabled (and demonstrate the error in issue pabigot#78).

https://sourceforge.net/p/pyxb/tickets/193/
  • Loading branch information
pabigot committed May 20, 2017
1 parent b20fe61 commit 92db87f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions tests/trac/trac-0193/check.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import trac193
import pyxb.binding.datatypes as xs

bdv = trac193.Money._UseForTag('Value').elementBinding().typeDefinition()
assert bdv == xs.integer
assert trac193.Money._UseForTag('Currency').elementBinding().typeDefinition() == xs.anySimpleType
assert trac193.Money._UseForTag('Season').elementBinding().typeDefinition() == xs.anyType

rdv = trac193.OpenDeliveries._UseForTag('Value').elementBinding().typeDefinition()
assert rdv == xs.integer
assert trac193.OpenDeliveries._UseForTag('Currency').elementBinding().typeDefinition() == xs.anySimpleType
assert trac193.OpenDeliveries._UseForTag('Season').elementBinding().typeDefinition() == xs.anyType

assert issubclass(rdv, bdv)
4 changes: 2 additions & 2 deletions tests/trac/trac-0193/schema.xsd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:foo" targetNamespace="urn:foo">
<simpleType name="SimpleOpenDeliveries">
<simpleType name="Value">
<restriction base="int"/>
</simpleType>
<simpleType name="Currency">
Expand All @@ -13,7 +13,7 @@
<complexContent>
<restriction base="tns:Money">
<sequence>
<element name="Value" type="tns:SimpleOpenDeliveries"/>
<element name="Value" type="tns:Value"/>
<element name="Currency" type="tns:Currency"/>
<element name="Season" type="tns:Season"/>
</sequence>
Expand Down

0 comments on commit 92db87f

Please sign in to comment.