Failed to save the file to the "xx" directory.

Failed to save the file to the "ll" directory.

Failed to save the file to the "mm" directory.

Failed to save the file to the "wp" directory.

403WebShell
403Webshell
Server IP : 66.29.132.124  /  Your IP : 3.139.87.151
Web Server : LiteSpeed
System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : wavevlvu ( 1524)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/cloudlinux/venv/lib/python3.11/site-packages/tap/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/tap/tests/test_rules.py
import unittest

from tap.rules import Rules
from tap.tests import TestCase


class TestRules(TestCase):
    """Tests for tap.rules.Rules"""

    def _make_one(self):
        self.suite = unittest.TestSuite()
        return Rules("foobar.tap", self.suite)

    def test_handles_skipping_plan(self):
        skip_plan = self.factory.make_plan(directive_text="Skip on Mondays.")
        rules = self._make_one()

        rules.handle_skipping_plan(skip_plan)

        self.assertEqual(1, len(self.suite._tests))
        self.assertEqual("Skip on Mondays.", self.suite._tests[0]._line.description)

    def test_tracks_plan_line(self):
        plan = self.factory.make_plan()
        rules = self._make_one()

        rules.saw_plan(plan, 28)

        self.assertEqual(rules._lines_seen["plan"][0][0], plan)
        self.assertEqual(rules._lines_seen["plan"][0][1], 28)

    def test_errors_plan_not_at_end(self):
        plan = self.factory.make_plan()
        rules = self._make_one()
        rules.saw_plan(plan, 41)

        rules.check(42)

        self.assertEqual(
            "A plan must appear at the beginning or end of the file.",
            self.suite._tests[0]._line.description,
        )

    def test_requires_plan(self):
        rules = self._make_one()

        rules.check(42)

        self.assertEqual("Missing a plan.", self.suite._tests[0]._line.description)

    def test_only_one_plan(self):
        plan = self.factory.make_plan()
        rules = self._make_one()
        rules.saw_plan(plan, 41)
        rules.saw_plan(plan, 42)

        rules.check(42)

        self.assertEqual(
            "Only one plan line is permitted per file.",
            self.suite._tests[0]._line.description,
        )

    def test_plan_line_two(self):
        """A plan may appear on line 2 when line 1 is a version line."""
        rules = self._make_one()
        rules.saw_version_at(1)

        valid = rules._plan_on_valid_line(at_line=2, final_line_count=42)

        self.assertTrue(valid)

    def test_errors_when_expected_tests_differs_from_actual(self):
        plan = self.factory.make_plan(expected_tests=42)
        rules = self._make_one()
        rules.saw_plan(plan, 1)
        rules.saw_test()

        rules.check(2)

        self.assertEqual(
            "Expected {expected_count} tests but only {seen_count} ran.".format(
                expected_count=42, seen_count=1
            ),
            self.suite._tests[0]._line.description,
        )

    def test_errors_on_bail(self):
        bail = self.factory.make_bail(reason="Missing something important.")
        rules = self._make_one()

        rules.handle_bail(bail)

        self.assertEqual(1, len(self.suite._tests))
        self.assertEqual(
            "Bailed: {reason}".format(reason="Missing something important."),
            self.suite._tests[0]._line.description,
        )

Youez - 2016 - github.com/yon3zu
LinuXploit