From 810e2db876a4f10b4d416de641afb62fb7cb96c2 Mon Sep 17 00:00:00 2001 From: Colm O'Connor Date: Wed, 26 Apr 2023 16:25:35 +0100 Subject: [PATCH] REFACTOR : Remove Ensure library from tests. --- hitch/story/single-value.story | 13 ++++++------- hitch/story/unique-sequence.story | 3 +-- hitch/story/update-with-schema.story | 1 - 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/hitch/story/single-value.story b/hitch/story/single-value.story index c0db037..0f1946a 100644 --- a/hitch/story/single-value.story +++ b/hitch/story/single-value.story @@ -11,7 +11,6 @@ Single value: given: setup: | from strictyaml import Str, Int, load - from ensure import Ensure variations: Raise exception on None: steps: @@ -24,34 +23,34 @@ Single value: steps: - Run: code: | - Ensure(load("1", Str())).equals("1") + assert load("1", Str()) == "1" Int of 1: steps: - Run: code: | - Ensure(load("1", Int())).equals(1) + assert load("1", Int()) == 1 Empty value parsed as blank string by default: steps: - Run: code: | - Ensure(load("x:")).equals({"x": ""}) + assert load("x:") == {"x": ""} Empty document parsed as blank string by default: steps: - Run: code: | - Ensure(load("", Str())).equals("") + assert load("", Str()) == "" Null parsed as string null by default: steps: - Run: code: | - Ensure(load("null: null")).equals({"null": "null"}) + assert load("null: null") == {"null": "null"} #Single value with comment: #steps: #- Run: #code: | - #Ensure(load("# ought not to be parsed\nstring")).equals("string") + #assert load("# ought not to be parsed\nstring") == "string" diff --git a/hitch/story/unique-sequence.story b/hitch/story/unique-sequence.story index 17152c4..13f7010 100644 --- a/hitch/story/unique-sequence.story +++ b/hitch/story/unique-sequence.story @@ -11,7 +11,6 @@ Sequences of unique items (UniqueSeq): - C setup: | from strictyaml import UniqueSeq, Str, load, as_document - from ensure import Ensure schema = UniqueSeq(Str()) variations: @@ -19,7 +18,7 @@ Sequences of unique items (UniqueSeq): steps: - Run: code: | - Ensure(load(yaml_snippet, schema)).equals(["A", "B", "C", ]) + assert load(yaml_snippet, schema) == ["A", "B", "C", ] Parsing with one dupe raises an exception: given: diff --git a/hitch/story/update-with-schema.story b/hitch/story/update-with-schema.story index f104eae..158a016 100644 --- a/hitch/story/update-with-schema.story +++ b/hitch/story/update-with-schema.story @@ -7,7 +7,6 @@ Updating document with a schema: given: setup: | import strictyaml as s - from ensure import Ensure variations: GitHub \#72: steps: