Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  test_load.py   Sprache: Python

 
#!/usr/bin/env python

"""
tests for mozfile.load
"""

import mozunit
import pytest
from mozfile import load
from wptserve.handlers import handler
from wptserve.server import WebTestHttpd


@pytest.fixture(name="httpd_url")
def fixture_httpd_url():
    """Yield a started WebTestHttpd server."""

    @handler
    def example(request, response):
        """Example request handler."""
        body = b"example"
        return (
            200,
            [("Content-type""text/plain"), ("Content-length", len(body))],
            body,
        )

    httpd = WebTestHttpd(host="127.0.0.1", routes=[("GET""*", example)])

    httpd.start()
    yield httpd.get_url()
    httpd.stop()


def test_http(httpd_url):
    """Test with WebTestHttpd and a http:// URL."""
    content = load(httpd_url).read()
    assert content == b"example"


@pytest.fixture(name="temporary_file")
def fixture_temporary_file(tmpdir):
    """Yield a path to a temporary file."""
    foobar = tmpdir.join("foobar.txt")
    foobar.write("hello world")

    yield str(foobar)

    foobar.remove()


def test_file_path(temporary_file):
    """Test loading from a file path."""
    assert load(temporary_file).read() == "hello world"


def test_file_url(temporary_file):
    """Test loading from a file URL."""
    assert load("file://%s" % temporary_file).read() == "hello world"


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

Messung V0.5
C=70 H=90 G=80

¤ Dauer der Verarbeitung: 0.15 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge