From 5d8a033f7610be6f1c20460e9cfda070ba5684b6 Mon Sep 17 00:00:00 2001 From: Marcelo Saguas Iacovone Date: Sat, 17 Feb 2024 13:02:18 -0800 Subject: [PATCH] Fixes Python2.7 compatibility for doctests --- cmdx.py | 57 +++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 14 deletions(-) diff --git a/cmdx.py b/cmdx.py index 64f00d6..49923bb 100644 --- a/cmdx.py +++ b/cmdx.py @@ -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 """ @@ -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 """ @@ -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"] @@ -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 """