PHP 8.2.30
Preview: test_rstrip.py Size: 1.58 KB
/opt/alt/python34/lib64/python3.4/idlelib/idle_test/test_rstrip.py

import unittest
import idlelib.RstripExtension as rs
from idlelib.idle_test.mock_idle import Editor

class rstripTest(unittest.TestCase):

    def test_rstrip_line(self):
        editor = Editor()
        text = editor.text
        do_rstrip = rs.RstripExtension(editor).do_rstrip

        do_rstrip()
        self.assertEqual(text.get('1.0', 'insert'), '')
        text.insert('1.0', '     ')
        do_rstrip()
        self.assertEqual(text.get('1.0', 'insert'), '')
        text.insert('1.0', '     \n')
        do_rstrip()
        self.assertEqual(text.get('1.0', 'insert'), '\n')

    def test_rstrip_multiple(self):
        editor = Editor()
        #  Uncomment following to verify that test passes with real widgets.
##        from idlelib.EditorWindow import EditorWindow as Editor
##        from tkinter import Tk
##        editor = Editor(root=Tk())
        text = editor.text
        do_rstrip = rs.RstripExtension(editor).do_rstrip

        original = (
            "Line with an ending tab    \n"
            "Line ending in 5 spaces     \n"
            "Linewithnospaces\n"
            "    indented line\n"
            "    indented line with trailing space \n"
            "    ")
        stripped = (
            "Line with an ending tab\n"
            "Line ending in 5 spaces\n"
            "Linewithnospaces\n"
            "    indented line\n"
            "    indented line with trailing space\n")

        text.insert('1.0', original)
        do_rstrip()
        self.assertEqual(text.get('1.0', 'insert'), stripped)

if __name__ == '__main__':
    unittest.main(verbosity=2, exit=False)

Directory Contents

Dirs: 1 × Files: 26

Name Size Perms Modified Actions
- drwxr-xr-x 2024-05-23 07:04:39
Edit Download
13.33 KB lrw-r--r-- 2024-04-17 17:09:57
Edit Download
1.54 KB lrw-r--r-- 2024-04-17 17:09:57
Edit Download
11.27 KB lrw-r--r-- 2024-04-17 17:09:57
Edit Download
5.05 KB lrw-r--r-- 2019-03-18 16:51:26
Edit Download
4.88 KB lrw-r--r-- 2024-04-17 17:09:57
Edit Download
4.02 KB lrw-r--r-- 2024-04-17 17:09:57
Edit Download
6.49 KB lrw-r--r-- 2024-04-17 17:09:57
Edit Download
734 B lrw-r--r-- 2024-04-17 17:09:57
Edit Download
2.34 KB lrw-r--r-- 2024-04-17 17:09:57
Edit Download
1.26 KB lrw-r--r-- 2024-04-17 17:09:57
Edit Download
586 B lrw-r--r-- 2024-04-17 17:09:57
Edit Download
14.00 KB lrw-r--r-- 2024-04-17 17:09:57
Edit Download
2.61 KB lrw-r--r-- 2024-04-17 17:09:57
Edit Download
8.85 KB lrw-r--r-- 2024-04-17 17:09:57
Edit Download
5.34 KB lrw-r--r-- 2024-04-17 17:09:57
Edit Download
8.17 KB lrw-r--r-- 2024-04-17 17:09:57
Edit Download
3.46 KB lrw-r--r-- 2024-04-17 17:09:57
Edit Download
882 B lrw-r--r-- 2024-04-17 17:09:57
Edit Download
1.58 KB lrw-r--r-- 2024-04-17 17:09:57
Edit Download
5.73 KB lrw-r--r-- 2024-04-17 17:09:57
Edit Download
11.24 KB lrw-r--r-- 2024-04-17 17:09:57
Edit Download
6.58 KB lrw-r--r-- 2024-04-17 17:09:57
Edit Download
2.80 KB lrw-r--r-- 2024-04-17 17:09:57
Edit Download
3.06 KB lrw-r--r-- 2024-04-17 17:09:57
Edit Download
4.03 KB lrw-r--r-- 2024-04-17 17:09:57
Edit Download
356 B lrw-r--r-- 2024-04-17 17:09:57
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).