Python-Doublex.

Testendoppel-Framework für Python
Jetzt downloaden

Python-Doublex. Ranking & Zusammenfassung

Anzeige

  • Rating:
  • Lizenz:
  • GPL v3
  • Preis:
  • FREE
  • Name des Herausgebers:
  • David Villa Alises
  • Website des Verlags:
  • https://bitbucket.org/DavidVilla/

Python-Doublex. Stichworte


Python-Doublex. Beschreibung

Python-Doublex ist ein leistungsfähiges Test-Doubles-Framework für Python.Das begann als Versuch, Pydouboules-Codebase und das Apisource-Repository zu verbessern und zu vereinfachen, ist: https://bitbucket.org/davidvilla/python-doublexdesign . Es vermeidet stilles falsch. = Stub () mit Stub: stub.foo ('hi'). Rückgabe (10) stub.Hello (Any_arg) .ralurns (false) stub.bye (). Erhöhungen (Someexception) # whenresult = stub.foo () # thendassert_that (Ergebnis, 10) "Verifiziert" Stubclass Collaborator: Def Hello (Self): Return "Hallo" mit Stub (Collaborator) als Stub Stub.Hello (). Erhöhungen (Someexception) stub.foo (). Returns (true) # Erhöhungen Apimismatch-Ausnahme-Stub ) sender.send_mail ('foo@bar.net ') # damalsassert_that (sender.helo (), "ok") Assert_that (sender.send_mail, angerufen ()) Assert_that (sender.send_mail, genannt (). mal (2) ) Assert_that (sender.send_mail, namens_with ('foo@bar.net ')) "Ver IFIED "RYCLASS SENDER: DEF SAY (SELBST): Zurück" HI "def Send_mail (Self, Adresse, Force = TRUE): Sender = Spion (Sender) Sender.bar () # hebt Apimismatch-Ausnahmeender.send_mail ( ) # hebt Apimismatch-Ausnahmeender.send_mail (falsch = 1) # hebt Apimismatch-Ausnahmeender.send_mail ('foo', falsche = 1) # hebt Apimismatch aus AUSSCHLUSSPROXYSPYSENDER = Spion (Sender ()) # Muss einen Instanceender.say ('Boo! " ) # Apimismatch-ApimisMatch-ApimsmatchStassert_Dat ("bill@apple.com") smtp.data (any_arg) .ralurns (true). × (2) smtp.helo () smtp.mail ("poormen@home.net") smtp.rcpt ("Bill @ Apple") .com ") smtp.data (" jemand da ") smtp.data (" ich habe Angst .. ") assert_that (smtp, meets_expectations ()?)" verifiziertMockclass SMTP: def helo (self): Def Mail (Self, Adresse): DEF RCPT (Self, Adresse): mit Mock (STMP) als SMTP: SMTP.Wrong () # hebt Apimismatch-Ausnahme SMTP.mail () # erhöhen s Apimismatch-Ausnahmstub-MethodScollaborator = Collaborator () Collaborator.Foo = Method_rückverleiht ("Tschüss"). ) entspricht jedem Aufruf zu einer Methode: spy.spy () spy.m1 () spy.m2 (none) spy.m3 ("hi", 3.0) spy.m4 () Assert_Dat (spy.m1, Angerufen ()) Assert_Dat (Spy.m2, genannt ()) Assert_Dat (Spy.m3, genannt ()) Assert_Dat (Spy.m4, genannt ()) namens_withcalled_with () übereinstimmt spezifische Argumente: spy.spy () spy.m1 () ) spy.m2 (none) spy.m3 ("hi", 3.0) spy.m4 () assert_dat (spy.m1, namens_with ()) assert_dat (spy.m2, right_with (none)) assert_dat ( Spy.m3, namens_with ("Hi", 3.0)) ASSERT_DAT (SPY.M4, Right_With ()) Matcher, Matcher, Hamcrest-Matcher ... Doublex unterstützt alle Hamcrest-Matcher und ihre erstaunlichen Kombinationen.Escly argsspy = spionieren () spy.foo ("ABCD") Assert_Dat (spy.foo, namens_with (Has_length (4))) Assert_Dat (spy.foo, right_with (Has_leng TH (GROUTE_THAN (3)))) Assert_dat (spy.foo, namens_with (Has_Length (WEGER_THAN (5)))) Assert_Dat (spy.foo, is_not (genannt_with (HAS_LENGTH (GROTRY_THAN (5))))), stupfenmit spy () als Spion: spy.foo (has_length (weniger_han (4))). Returns (Homepage des Produkts)


Python-Doublex. Zugehörige Software