Skip to content

Commit

Permalink
Fixes Python2.7 compatibility for doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
chelloiaco committed Feb 17, 2024
1 parent 4f335ed commit 5d8a033
Showing 1 changed file with 43 additions and 14 deletions.
57 changes: 43 additions & 14 deletions cmdx.py
Original file line number Diff line number Diff line change
Expand Up @@ -1524,13 +1524,21 @@ def __or__(self, other):
>>> _new()
>>> parent = createNode("transform", "parent")
>>> child = createNode("transform", "child", parent)
>>> (parent | "child").path()
'|parent|child'
>>> result = (parent | "child").path()
>>> result in (
... '|parent|child',
... u'|parent|child'
... )
True
# Stackable too
>>> grand = createNode("transform", "grand", child)
>>> (parent | "child" | "grand").path()
'|parent|child|grand'
>>> result = (parent | "child" | "grand").path()
>>> result in (
... '|parent|child|grand',
... u'|parent|child|grand'
... )
True
"""

Expand Down Expand Up @@ -2303,8 +2311,12 @@ def flatten(self, type=None):
>>> cc = cmds.sets([gc, b], name="child")
>>> parent = cmds.sets([cc, c], name="parent")
>>> mainset = encode(parent)
>>> sorted([n.path() for n in mainset.flatten()])
['|a', '|b', '|c']
>>> result = sorted([n.path() for n in mainset.flatten()])
>>> result in (
... ['|a', '|b', '|c'],
... [u'|a', u'|b', u'|c']
... )
True
"""

Expand Down Expand Up @@ -6358,16 +6370,25 @@ def connect(self, src, dst, force=True):
>>> with DagModifier() as mod:
... mod.connect(tm["sx"], tm["tx"])
...
>>> tm["tx"].connection().path()
'|myTransform'
>>> result = tm["tx"].connection().path()
>>> result in (
... '|myTransform',
... u'|myTransform'
... )
True
>>> cmds.undo()
>>> tm["tx"].connection() is None
True
# Connect without undo
>>> tm["tx"] << tx["output"]
>>> tm["tx"].connection().name()
'myAnimCurve'
>>> result = tm["tx"].connection().name()
>>> result in (
... 'myAnimCurve',
... u'myAnimCurve'
... )
True
# Disconnect without undo
>>> tm["tx"] // tx["output"]
Expand Down Expand Up @@ -6452,12 +6473,20 @@ def connectAttr(self, srcPlug, dstNode, dstAttr):
... otherAttr = mod.addAttr(otherNode, Message("otherAttr"))
... mod.connectAttr(newNode["newAttr"], otherNode, otherAttr)
...
>>> newNode["newAttr"].connection().path()
'|otherNode'
>>> result = newNode["newAttr"].connection().path()
>>> result in (
... '|otherNode',
... u'|otherNode'
... )
True
>>> cmds.undo()
>>> newNode["newAttr"].connection().path()
'|newNode'
>>> result = newNode["newAttr"].connection().path()
>>> result in (
... '|newNode',
... u'|newNode'
... )
True
"""

Expand Down

0 comments on commit 5d8a033

Please sign in to comment.