Fix tests in the correct manner

This commit is contained in:
Tim Bentley 2013-02-13 17:33:37 +00:00
parent 193e96ee5a
commit 6be6a54d6e
2 changed files with 11 additions and 8 deletions

View File

@ -322,7 +322,7 @@ class Settings(QtCore.QSettings):
""" """
# if group() is not empty the group has not been specified together with the key. # if group() is not empty the group has not been specified together with the key.
if self.group(): if self.group():
default_value = Settings.__default_settings__[unicode(self.group() + u'/' + key)] default_value = Settings.__default_settings__[self.group() + u'/' + key]
else: else:
default_value = Settings.__default_settings__[key] default_value = Settings.__default_settings__[key]
setting = super(Settings, self).value(key, default_value) setting = super(Settings, self).value(key, default_value)
@ -343,13 +343,8 @@ class Settings(QtCore.QSettings):
""" """
# On OS X (and probably on other platforms too) empty value from QSettings is represented as type # On OS X (and probably on other platforms too) empty value from QSettings is represented as type
# PyQt4.QtCore.QPyNullVariant. This type has to be converted to proper 'None' Python type. # PyQt4.QtCore.QPyNullVariant. This type has to be converted to proper 'None' Python type.
# Python wants the test one way but nose wants it the other way Madness! if isinstance(setting, QtCore.QPyNullVariant) and setting.isNull():
try: setting = None
if isinstance(setting, QtCore.QPyNullVariant) and setting.isNull():
setting = None
except AttributeError:
if setting.isNull() and isinstance(setting, QtCore.QPyNullVariant):
setting = None
# Handle 'None' type (empty value) properly. # Handle 'None' type (empty value) properly.
if setting is None: if setting is None:
# An empty string saved to the settings results in a None type being returned. # An empty string saved to the settings results in a None type being returned.

View File

@ -0,0 +1,8 @@
import sip
sip.setapi(u'QDate', 2)
sip.setapi(u'QDateTime', 2)
sip.setapi(u'QString', 2)
sip.setapi(u'QTextStream', 2)
sip.setapi(u'QTime', 2)
sip.setapi(u'QUrl', 2)
sip.setapi(u'QVariant', 2)