Issue 1820: structseq objects did not work with the % formatting operator or isinstance(t, tuple).

Orignal patch (without tests) by Leif Walsh.
This commit is contained in:
Raymond Hettinger 2008-01-15 03:02:37 +00:00
parent a01ed03058
commit c216df9288
4 changed files with 12 additions and 1 deletions

View file

@ -26,6 +26,12 @@ class StructSeqTest(unittest.TestCase):
for i in xrange(-len(t), len(t)-1):
self.assertEqual(t[i], astuple[i])
def test_tuple_subclass(self):
# Issue 1820
t = time.localtime()
s = ('%s ' * len(t)) % t # This used to fail because t was not a tuple subclass
self.assert_(isinstance(t, tuple))
def test_repr(self):
t = time.gmtime()
self.assert_(repr(t))