404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.142.42.247: ~ $
from unittest import mock

from tap.adapter import Adapter
from tap.tests import TestCase


class TestAdapter(TestCase):
    """Tests for tap.adapter.Adapter"""

    def test_adapter_has_filename(self):
        """The adapter has a TAP filename."""
        tap_filename = "fake.tap"
        adapter = Adapter(tap_filename, None)

        self.assertEqual(tap_filename, adapter._filename)

    def test_handles_ok_test_line(self):
        """Add a success for an ok test line."""
        ok_line = self.factory.make_ok()
        adapter = Adapter("fake.tap", ok_line)
        result = mock.Mock()

        adapter(result)

        self.assertTrue(result.addSuccess.called)

    def test_handles_skip_test_line(self):
        """Add a skip when a test line contains a skip directive."""
        skip_line = self.factory.make_ok(directive_text="SKIP This is the reason.")
        adapter = Adapter("fake.tap", skip_line)
        result = self.factory.make_test_result()

        adapter(result)

        self.assertEqual(1, len(result.skipped))
        self.assertEqual("This is the reason.", result.skipped[0][1])

    def test_handles_ok_todo_test_line(self):
        """Add an unexpected success for an ok todo test line."""
        todo_line = self.factory.make_ok(directive_text="TODO An incomplete test")
        adapter = Adapter("fake.tap", todo_line)
        result = self.factory.make_test_result()

        adapter(result)

        self.assertEqual(1, len(result.unexpectedSuccesses))

    def test_handles_not_ok_todo_test_line(self):
        """Add an expected failure for a not ok todo test line."""
        todo_line = self.factory.make_not_ok(directive_text="TODO An incomplete test")
        adapter = Adapter("fake.tap", todo_line)
        result = self.factory.make_test_result()

        adapter(result)

        self.assertEqual(1, len(result.expectedFailures))

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
__init__.py File 71 B 0644
factory.py File 1.05 KB 0644
run.py File 456 B 0644
test_adapter.py File 1.84 KB 0644
test_directive.py File 1.2 KB 0644
test_formatter.py File 601 B 0644
test_line.py File 1.2 KB 0644
test_loader.py File 3.66 KB 0644
test_main.py File 1.96 KB 0644
test_parser.py File 16.24 KB 0644
test_result.py File 3.4 KB 0644
test_rules.py File 2.81 KB 0644
test_runner.py File 3.32 KB 0644
test_tracker.py File 10.91 KB 0644
testcase.py File 222 B 0644