summaryrefslogtreecommitdiffstats
path: root/ipatests/test_ipalib
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/test_ipalib
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/test_ipalib')
-rw-r--r--ipatests/test_ipalib/test_parameters.py11
1 files changed, 5 insertions, 6 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()