summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_builtin.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2011-06-11 21:12:08 (GMT)
committerBenjamin Peterson <benjamin@python.org>2011-06-11 21:12:08 (GMT)
commit3bbb72265411585e64a5d2ccb5ba51763f20e311 (patch)
tree8ec38156f5e1b1851dcc8f0490e941bb56435427 /Lib/test/test_builtin.py
parent703f7c4bf5fa98f9b8b11593d3fa37eb68eae896 (diff)
downloadcpython-3bbb72265411585e64a5d2ccb5ba51763f20e311.zip
cpython-3bbb72265411585e64a5d2ccb5ba51763f20e311.tar.gz
cpython-3bbb72265411585e64a5d2ccb5ba51763f20e311.tar.bz2
allow __dir__ to return any sequence
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r--Lib/test/test_builtin.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index 97619cf..ce1586f 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -372,7 +372,15 @@ class BuiltinTest(unittest.TestCase):
f = Foo()
self.assertTrue(dir(f) == ["ga", "kan", "roo"])
- # dir(obj__dir__not_list)
+ # dir(obj__dir__tuple)
+ class Foo(object):
+ def __dir__(self):
+ return ("b", "c", "a")
+ res = dir(Foo())
+ self.assertIsInstance(res, list)
+ self.assertTrue(res == ["a", "b", "c"])
+
+ # dir(obj__dir__not_sequence)
class Foo(object):
def __dir__(self):
return 7