mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-20 23:59:49 +08:00
change: replace with assert err nil
This commit is contained in:
@@ -19,9 +19,7 @@ func TestStartsWith(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, data := range testData {
|
||||
if !assert.True(t, StartsWith(t, data.raw, data.expected)) {
|
||||
t.Fatal()
|
||||
}
|
||||
assert.True(t, StartsWith(t, data.raw, data.expected))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,9 +35,7 @@ func TestEndsWith(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, data := range testData {
|
||||
if !assert.True(t, EndsWith(t, data.raw, data.expected)) {
|
||||
t.Fatal()
|
||||
}
|
||||
assert.True(t, EndsWith(t, data.raw, data.expected))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,9 +71,7 @@ func TestLessThanLength(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, data := range testData {
|
||||
if !assert.True(t, LessThanLength(t, data.raw, data.expected)) {
|
||||
t.Fatal()
|
||||
}
|
||||
assert.True(t, LessThanLength(t, data.raw, data.expected))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,9 +89,7 @@ func TestLessOrEqualsLength(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, data := range testData {
|
||||
if !assert.True(t, LessOrEqualsLength(t, data.raw, data.expected)) {
|
||||
t.Fatal()
|
||||
}
|
||||
assert.True(t, LessOrEqualsLength(t, data.raw, data.expected))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,9 +104,7 @@ func TestGreaterThanLength(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, data := range testData {
|
||||
if !assert.True(t, GreaterThanLength(t, data.raw, data.expected)) {
|
||||
t.Fatal()
|
||||
}
|
||||
assert.True(t, GreaterThanLength(t, data.raw, data.expected))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,9 +122,7 @@ func TestGreaterOrEqualsLength(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, data := range testData {
|
||||
if !assert.True(t, GreaterOrEqualsLength(t, data.raw, data.expected)) {
|
||||
t.Fatal()
|
||||
}
|
||||
assert.True(t, GreaterOrEqualsLength(t, data.raw, data.expected))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,9 +137,7 @@ func TestContainedBy(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, data := range testData {
|
||||
if !assert.True(t, ContainedBy(t, data.raw, data.expected)) {
|
||||
t.Fatal()
|
||||
}
|
||||
assert.True(t, ContainedBy(t, data.raw, data.expected))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,9 +156,7 @@ func TestStringEqual(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, data := range testData {
|
||||
if !assert.True(t, StringEqual(t, data.raw, data.expected)) {
|
||||
t.Fatal()
|
||||
}
|
||||
assert.True(t, StringEqual(t, data.raw, data.expected))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,9 +171,7 @@ func TestEqualFold(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, data := range testData {
|
||||
if !assert.True(t, EqualFold(t, data.raw, data.expected)) {
|
||||
t.Fatal()
|
||||
}
|
||||
assert.True(t, EqualFold(t, data.raw, data.expected))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,8 +185,6 @@ func TestRegexMatch(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, data := range testData {
|
||||
if !assert.True(t, RegexMatch(t, data.raw, data.expected)) {
|
||||
t.Fatal()
|
||||
}
|
||||
assert.True(t, RegexMatch(t, data.raw, data.expected))
|
||||
}
|
||||
}
|
||||
|
||||
62
internal/scaffold/templates/debugtalk.py
Normal file
62
internal/scaffold/templates/debugtalk.py
Normal file
@@ -0,0 +1,62 @@
|
||||
import logging
|
||||
import time
|
||||
from typing import List
|
||||
|
||||
|
||||
# commented out function will be filtered
|
||||
# def get_headers():
|
||||
# return {"User-Agent": "hrp"}
|
||||
|
||||
|
||||
def get_user_agent():
|
||||
return "hrp/funppy"
|
||||
|
||||
|
||||
def sleep(n_secs):
|
||||
time.sleep(n_secs)
|
||||
|
||||
|
||||
def sum(*args):
|
||||
result = 0
|
||||
for arg in args:
|
||||
result += arg
|
||||
return result
|
||||
|
||||
|
||||
def sum_ints(*args: List[int]) -> int:
|
||||
result = 0
|
||||
for arg in args:
|
||||
result += arg
|
||||
return result
|
||||
|
||||
|
||||
def sum_two_int(a: int, b: int) -> int:
|
||||
return a + b
|
||||
|
||||
|
||||
def sum_two_string(a: str, b: str) -> str:
|
||||
return a + b
|
||||
|
||||
|
||||
def sum_strings(*args: List[str]) -> str:
|
||||
result = ""
|
||||
for arg in args:
|
||||
result += arg
|
||||
return result
|
||||
|
||||
|
||||
def concatenate(*args: List[str]) -> str:
|
||||
result = ""
|
||||
for arg in args:
|
||||
result += str(arg)
|
||||
return result
|
||||
|
||||
|
||||
def setup_hook_example(name):
|
||||
logging.warning("setup_hook_example")
|
||||
return f"setup_hook_example: {name}"
|
||||
|
||||
|
||||
def teardown_hook_example(name):
|
||||
logging.warning("teardown_hook_example")
|
||||
return f"teardown_hook_example: {name}"
|
||||
@@ -1 +1 @@
|
||||
v5.0.0-beta-2503052228
|
||||
v5.0.0-beta-2503052233
|
||||
|
||||
Reference in New Issue
Block a user