Show More
@@ -1579,6 +1579,14 b' class InteractiveShell(SingletonConfigurable):' | |||
|
1579 | 1579 | |
|
1580 | 1580 | def object_inspect_text(self, oname, detail_level=0): |
|
1581 | 1581 | """Get object info as formatted text""" |
|
1582 | return self.object_inspect_mime(oname, detail_level)['text/plain'] | |
|
1583 | ||
|
1584 | def object_inspect_mime(self, oname, detail_level=0): | |
|
1585 | """Get object info as a mimebundle of formatted representations. | |
|
1586 | ||
|
1587 | A mimebundle is a dictionary, keyed by mime-type. | |
|
1588 | It must always have the key `'text/plain'`. | |
|
1589 | """ | |
|
1582 | 1590 | with self.builtin_trap: |
|
1583 | 1591 | info = self._object_find(oname) |
|
1584 | 1592 | if info.found: |
@@ -514,6 +514,12 b' class InteractiveShellTestCase(unittest.TestCase):' | |||
|
514 | 514 | else: |
|
515 | 515 | self.assertEqual(msg, 'IPython.core.tests.test_interactiveshell.DerivedInterrupt: foo\n') |
|
516 | 516 | |
|
517 | def test_inspect_text(self): | |
|
518 | ip.run_cell('a = 5') | |
|
519 | text = ip.object_inspect_text('a') | |
|
520 | self.assertIsInstance(text, unicode_type) | |
|
521 | ||
|
522 | ||
|
517 | 523 | class TestSafeExecfileNonAsciiPath(unittest.TestCase): |
|
518 | 524 | |
|
519 | 525 | @onlyif_unicode_paths |
General Comments 0
You need to be logged in to leave comments.
Login now