def testCanonicalise(self): def assertCanon(reference, worksheetNames, expected): ref = FLReferenceParseNode(None, [reference, '!', sentinel.onlyChild]) ref.canonicalise(worksheetNames) self.assertEquals(ref.children[0], expected) assertCanon('foo', ['foO'], 'foO') assertCanon('foo', [], 'foo') assertCanon("'''s'", ["'S"], "'''S'") assertCanon("foo ", [], 'foo ') ref = FLReferenceParseNode(None, ['A1']) ref.canonicalise([]) self.assertEquals(ref.worksheetReference, None)
def canonicalise(self, wsNames): self.localReference = self.localReference.upper() FLReferenceParseNode.canonicalise(self, wsNames)
def assertCanon(reference, worksheetNames, expected): ref = FLReferenceParseNode(None, [reference, '!', sentinel.onlyChild]) ref.canonicalise(worksheetNames) self.assertEquals(ref.children[0], expected)