Discussion/help for any of my projects, such as gometalinter, kingpin, voluptuous, EntityX, etc.
alecthomas on master
Add scripts to pawk (compare)
alecthomas on v0.8.0
Fix 0.8.0 release thanks to @jr… (compare)
alecthomas on master
Add hermit Fix 0.8.0 release thanks to @jr… (compare)
I'm having a curious problem with pytest-voluptuous==1.1.0 (and voluptuous==0.11.5). Below timing.1.source has value "create," and the actual value is "create," but get assertion error and this doesn't really compute?
I should point out that timing.0 is fine. timing.1.duration_in_ms is also fine. Just timing.1.source that's failing.
v1_base_url = 'http://127.0.0.1:64387/v1'
def test_customers_create(v1_base_url):
url = v1_base_url + "/customers"
data = {
"first_name": "john",
"last_name": "doe",
"email": "johndoe@example.com",
"phone_number": "04555555555"
}
r = requests.post(url, json=data)
assert r.status_code == 200
> assert r.json() == S(
{
"success": True,
"timing": [
{"duration_in_ms": int, "source": "backend_api_call"},
{"duration_in_ms": int, "source": "create"}
],
"messages": ["Customer created", "OK"],
"response": {"unnecessary": "crap"}
)
E AssertionError: assert failed to validation error(s):
E - timing.1.source: not a valid value (actual: 'create')
{
"success": true,
"response": { "unnecessary": "crap" },
"timing": [
{
"duration_in_ms": 629,
"source": "backend_api_call"
},
{
"duration_in_ms": 655,
"source": "create"
}
],
"messages": [
"Customer created",
"OK"
],
"time": "2019-08-12T03:53:41.070455Z"
}
{...}
matched, but then failed on a sub-key
{...}
) it will not exit
myapp -a b -c
, b -c
are non-options
participle.Capture
interface on a custom type
type Time time.Time
func (t *Time) Capture(tokens []string) error {
s, err := time.Parse("...", tokens[0])
...
*t = s
return nil
}