def _isstring(obj):
- return isinstance(obj, StringType) or isinstance(obj, UnicodeType)
+ return isinstance(obj, StringType) or isinstance(obj, UnicodeType)
\f
characters except the dot used for Python package names are
collapsed and replaced with a single underscore, e.g. ' -;#'
becomes '_'.
-
+
"""
return '_'.join(_norm_encoding_RE.split(encoding))
cls = self.theclass
datestr = '0001-02-03'
for ofs in None, zero, plus, minus, unknown:
- for us in 0, 987001:
+ for us in 0, 987001:
d = cls(1, 2, 3, 4, 5, 59, us, tzinfo=ofs)
timestr = '04:05:59' + (us and '.987001' or '')
ofsstr = ofs is not None and d.tzname() or ''
if attr == 'a':
return 2
else:
- return super(C2, self).__getattribute__(attr)
+ return super(C2, self).__getattribute__(attr)
def meth(self):
return 1
class D(C):
# Immediate subclasses have their mro's adjusted in alphabetical
# order, so E's will get adjusted before adjusting F's fails. We
# check here that E's gets restored.
-
+
E_mro_before = E.__mro__
D_mro_before = D.__mro__
pass
else:
raise TestFailed, "didn't catch MRO conflict"
-
+
def mutable_names():
class C(object):
pass
# C.__module__ could be 'test_descr' or '__main__'
mod = C.__module__
-
+
C.__name__ = 'D'
vereq((C.__module__, C.__name__), (mod, 'D'))
C.__name__ = 'D.E'
vereq((C.__module__, C.__name__), (mod, 'D.E'))
-
+
def test_main():
do_this_first()
if __name__ == "__main__":
test_main()
-
print " returned: " + str(gotResult)
print ""
errors = errors + 1
-
+
tester('ntpath.splitext("foo.ext")', ('foo', '.ext'))
tester('ntpath.splitext("/foo/foo.ext")', ('/foo/foo', '.ext'))
tester('ntpath.splitext(".ext")', ('', '.ext'))
class TestCase(unittest.TestCase):
fn = "shelftemp.db"
-
+
def test_ascii_file_shelf(self):
try:
s = shelve.open(self.fn, binary=False)