from PySide.QtGui import QMacStyle
from PySide.QtWidgets import QApplication, QLabel
from PySide.QtCore import QObject

import unittest

from helper import UsesQApplication

class QMacStyleTest(UsesQApplication):
    def testWidgetStyle(self):
        w = QLabel('Hello')
        self.assertTrue(isinstance(w.style(), QMacStyle))

if __name__ == '__main__':
    unittest.main()

# Qt5: this is gone: from PySide.QtGui import QMacStyle
from PySide.QtWidgets import QApplication, QLabel, QStyleFactory
from PySide.QtCore import QObject

import unittest

from helper import UsesQApplication

QMacStyle = type(QStyleFactory.create('Macintosh'))

class QMacStyleTest(UsesQApplication):
    def testWidgetStyle(self):
        w = QLabel('Hello')
        self.assertTrue(isinstance(w.style(), QMacStyle))

if __name__ == '__main__':
    unittest.main()

fix QMacStyle test by usingg QStyleFactory (QMaxStyle is private now)