-
Notifications
You must be signed in to change notification settings - Fork 220
Codewars Python Test Framework
Blind4Basics edited this page Jan 6, 2018
·
17 revisions
test.describe("Example Tests")
test.it("Example Test Case")
test.assert_equals(add(1, 1), 2, "Optional Message")
print("<COMPLETEDIN::>")
print("<COMPLETEDIN::>")
TODO Improve the descriptions while keeping them simple.
Checks that the actual value equals the expected value.
Checks that the actual value does not equal the expected value.
Checks that function
throws`.
Checks that passed
is truthy. Note that the test suite will continue its execution if the keyword allow_raise
isn't manually set to True
.
In Python, the Test.describe
and Test.it
will concatenate themselves if you do not use this element to close the blocks. Note that the statement will not show up in the console.
Test.describe("1")
Test.it("A")
Test.describe("2")
Test.it("B")
Test.it("C")
Leads to:
1
A
2
B
C
Test.describe("1")
Test.it("A")
print("<COMPLETEDIN::>") # <- close it
print("<COMPLETEDIN::>") # <- close describe
Test.describe("2")
Test.it("B")
print("<COMPLETEDIN::>") # <- close it
Test.it("C")
print("<COMPLETEDIN::>") # <- close it
print("<COMPLETEDIN::>") # <- close describe
Leads to:
1
A
2
B
C