It seems the new line character is supported for labels and names (Newline in node label in dot (graphviz) language), but tool tips are put directly into the resultant HTML, which does not see "\n" as a special character.
Using direct character codes is an alternative. (see Formatting & ASCII Control Codes)
node = pydot.Node('abc', style='filled', fillcolor='#CCFF00', fontsize=12)
# specify HTML Carriage Return (\r) and/or Line Feed (\n) characters directly
txt = 'foo' + ' ' + test'
node.set_tooltip(txt)
Or some simple pre-processing would allow you to keep the '\n' form:
node.set_tooltip(txt.replace('\n', ' '))
- Note that for HTML-Like Labels, using the above replace-with-entity in the only way to have multiline-tooltips.