summaryrefslogtreecommitdiffstats
path: root/ipatests
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2015-09-17 17:56:45 +0200
committerJan Cholasta <jcholast@redhat.com>2015-10-07 10:27:20 +0200
commite3c05fcb73c5a1081167d73278785bf18d652dab (patch)
tree2e812fea2e20b5808371975da090a829dd5c66f3 /ipatests
parent65e3b9edc66d7dfe885df143c16a59588af8192f (diff)
downloadfreeipa-e3c05fcb73c5a1081167d73278785bf18d652dab.tar.gz
freeipa-e3c05fcb73c5a1081167d73278785bf18d652dab.tar.xz
freeipa-e3c05fcb73c5a1081167d73278785bf18d652dab.zip
Remove uses of the `types` module
In Python 3, the types module no longer provide alternate names for built-in types, e.g. `types.StringType` can just be spelled `str`. NoneType is also removed; it needs to be replaced with type(None) Reviewed-By: David Kupka <dkupka@redhat.com> Reviewed-By: Jan Cholasta <jcholast@redhat.com> Reviewed-By: Martin Basti <mbasti@redhat.com>
Diffstat (limited to 'ipatests')
-rw-r--r--ipatests/test_ipalib/test_parameters.py11
-rw-r--r--ipatests/test_xmlrpc/test_hbactest_plugin.py3
2 files changed, 6 insertions, 8 deletions
diff --git a/ipatests/test_ipalib/test_parameters.py b/ipatests/test_ipalib/test_parameters.py
index 41c10fad4..845e4290d 100644
--- a/ipatests/test_ipalib/test_parameters.py
+++ b/ipatests/test_ipalib/test_parameters.py
@@ -28,7 +28,6 @@ Test the `ipalib.parameters` module.
import datetime
import re
import sys
-from types import NoneType
from decimal import Decimal
from inspect import isclass
from six.moves.xmlrpc_client import MAXINT, MININT
@@ -480,10 +479,10 @@ class test_Param(ClassChecker):
# Test with wrong (scalar) type:
e = raises(TypeError, o.validate, (None, None, 42, None), 'cli')
- assert str(e) == TYPE_ERROR % ('my_param', NoneType, 42, int)
+ assert str(e) == TYPE_ERROR % ('my_param', type(None), 42, int)
o = self.cls('my_param')
e = raises(TypeError, o.validate, 'Hello', 'cli')
- assert str(e) == TYPE_ERROR % ('my_param', NoneType, 'Hello', str)
+ assert str(e) == TYPE_ERROR % ('my_param', type(None), 'Hello', str)
class Example(self.cls):
type = int
@@ -650,7 +649,7 @@ class test_Flag(ClassChecker):
# Test that TypeError is raise if default is not a bool:
e = raises(TypeError, self.cls, 'my_flag', default=None)
- assert str(e) == TYPE_ERROR % ('default', bool, None, NoneType)
+ assert str(e) == TYPE_ERROR % ('default', bool, None, type(None))
# Test with autofill=False, default=True
o = self.cls('my_flag', autofill=False, default=True)
@@ -685,7 +684,7 @@ class test_Data(ClassChecker):
Test the `ipalib.parameters.Data.__init__` method.
"""
o = self.cls('my_data')
- assert o.type is NoneType
+ assert o.type is type(None)
assert o.password is False
assert o.rules == tuple()
assert o.class_rules == tuple()
@@ -1231,7 +1230,7 @@ class test_Number(ClassChecker):
Test the `ipalib.parameters.Number.__init__` method.
"""
o = self.cls('my_number')
- assert o.type is NoneType
+ assert o.type is type(None)
assert o.password is False
assert o.rules == tuple()
assert o.class_rules == tuple()
diff --git a/ipatests/test_xmlrpc/test_hbactest_plugin.py b/ipatests/test_xmlrpc/test_hbactest_plugin.py
index 6f7b0a615..fc6a4118f 100644
--- a/ipatests/test_xmlrpc/test_hbactest_plugin.py
+++ b/ipatests/test_xmlrpc/test_hbactest_plugin.py
@@ -24,7 +24,6 @@ Test the `ipalib/plugins/hbactest.py` module.
from ipatests.test_xmlrpc.xmlrpc_test import XMLRPC_test, assert_attr_equal
from ipalib import api
from ipalib import errors
-from types import NoneType
from nose.tools import raises
# Test strategy:
@@ -114,7 +113,7 @@ class test_hbactest(XMLRPC_test):
rules=self.rule_names
)
assert ret['value'] == True
- assert type(ret['error']) == NoneType
+ assert ret['error'] is None
for i in [0,1,2,3]:
assert self.rule_names[i] in ret['matched']