1. Kirill Simonov
  2. pyyaml

Commits

Kirill Simonov  committed 19493c1

Rename error-message to loader-error and add new examples.

  • Participants
  • Parent commits 77c9072
  • Branches default

Comments (0)

Files changed (149)

File tests/data/document-separator-in-quoted-scalar.error-message

  • Ignore whitespace
----
-"this --- is correct"
----
-"this
-...is also
-correct"
----
-"a quoted scalar
-cannot contain
----
-document separators"

File tests/data/document-separator-in-quoted-scalar.loader-error

View file
  • Ignore whitespace
+---
+"this --- is correct"
+---
+"this
+...is also
+correct"
+---
+"a quoted scalar
+cannot contain
+---
+document separators"

File tests/data/duplicate-anchor-1.error-message

  • Ignore whitespace
-- &foo bar
-- &bar bar
-- &foo bar

File tests/data/duplicate-anchor-1.loader-error

View file
  • Ignore whitespace
+- &foo bar
+- &bar bar
+- &foo bar

File tests/data/duplicate-anchor-2.error-message

  • Ignore whitespace
-&foo [1, 2, 3, &foo 4]

File tests/data/duplicate-anchor-2.loader-error

View file
  • Ignore whitespace
+&foo [1, 2, 3, &foo 4]

File tests/data/duplicate-key.error-message

  • Ignore whitespace
----
-foo: bar
-foo: baz

File tests/data/duplicate-key.loader-error

View file
  • Ignore whitespace
+---
+foo: bar
+foo: baz

File tests/data/duplicate-mapping-key.error-message

  • Ignore whitespace
----
-&anchor foo:
-    foo: bar
-    *anchor: duplicate key
-    baz: bat
-    *anchor: duplicate key

File tests/data/duplicate-mapping-key.loader-error

View file
  • Ignore whitespace
+---
+&anchor foo:
+    foo: bar
+    *anchor: duplicate key
+    baz: bat
+    *anchor: duplicate key

File tests/data/duplicate-merge-key.error-message

  • Ignore whitespace
----
-<<: {x: 1, y: 2}
-foo: bar
-<<: {z: 3, t: 4}

File tests/data/duplicate-merge-key.loader-error

View file
  • Ignore whitespace
+---
+<<: {x: 1, y: 2}
+foo: bar
+<<: {z: 3, t: 4}

File tests/data/duplicate-tag-directive.error-message

  • Ignore whitespace
-%TAG    !foo!   bar
-%TAG    !foo!   baz
---- foo

File tests/data/duplicate-tag-directive.loader-error

View file
  • Ignore whitespace
+%TAG    !foo!   bar
+%TAG    !foo!   baz
+--- foo

File tests/data/duplicate-value-key.error-message

  • Ignore whitespace
----
-=: 1
-foo: bar
-=: 2

File tests/data/duplicate-value-key.loader-error

View file
  • Ignore whitespace
+---
+=: 1
+foo: bar
+=: 2

File tests/data/duplicate-yaml-directive.error-message

  • Ignore whitespace
-%YAML   1.1
-%YAML   1.1
---- foo

File tests/data/duplicate-yaml-directive.loader-error

View file
  • Ignore whitespace
+%YAML   1.1
+%YAML   1.1
+--- foo

File tests/data/empty-python-module.loader-error

View file
  • Ignore whitespace
+--- !!python:module:

File tests/data/empty-python-name.loader-error

View file
  • Ignore whitespace
+--- !!python/name: empty

File tests/data/expected-mapping.error-message

  • Ignore whitespace
---- !!map [not, a, map]

File tests/data/expected-mapping.loader-error

View file
  • Ignore whitespace
+--- !!map [not, a, map]

File tests/data/expected-scalar.error-message

  • Ignore whitespace
---- !!str [not a scalar]

File tests/data/expected-scalar.loader-error

View file
  • Ignore whitespace
+--- !!str [not a scalar]

File tests/data/expected-sequence.error-message

  • Ignore whitespace
---- !!seq {foo, bar, baz}

File tests/data/expected-sequence.loader-error

View file
  • Ignore whitespace
+--- !!seq {foo, bar, baz}

File tests/data/forbidden-entry.error-message

  • Ignore whitespace
-test: - foo
-      - bar

File tests/data/forbidden-entry.loader-error

View file
  • Ignore whitespace
+test: - foo
+      - bar

File tests/data/forbidden-key.error-message

  • Ignore whitespace
-test: ? foo
-      : bar

File tests/data/forbidden-key.loader-error

View file
  • Ignore whitespace
+test: ? foo
+      : bar

File tests/data/forbidden-value.error-message

  • Ignore whitespace
-test: key: value

File tests/data/forbidden-value.loader-error

View file
  • Ignore whitespace
+test: key: value

File tests/data/invalid-anchor-1.error-message

  • Ignore whitespace
---- &?  foo # we allow only ascii and numeric characters in anchor names.

File tests/data/invalid-anchor-1.loader-error

View file
  • Ignore whitespace
+--- &?  foo # we allow only ascii and numeric characters in anchor names.

File tests/data/invalid-anchor-2.error-message

  • Ignore whitespace
----
-- [
-    &correct foo,
-    *correct,
-    *correct]   # still correct
-- *correct: still correct
-- &correct-or-not[foo, bar]
-

File tests/data/invalid-anchor-2.loader-error

View file
  • Ignore whitespace
+---
+- [
+    &correct foo,
+    *correct,
+    *correct]   # still correct
+- *correct: still correct
+- &correct-or-not[foo, bar]
+

File tests/data/invalid-base64-data.error-message

  • Ignore whitespace
---- !!binary
-    binary data encoded in base64 should be here.

File tests/data/invalid-base64-data.loader-error

View file
  • Ignore whitespace
+--- !!binary
+    binary data encoded in base64 should be here.

File tests/data/invalid-block-scalar-indicator.error-message

  • Ignore whitespace
---- > what is this?  # a comment
-data

File tests/data/invalid-block-scalar-indicator.loader-error

View file
  • Ignore whitespace
+--- > what is this?  # a comment
+data

File tests/data/invalid-character.error-message

  • Ignore whitespace
Binary file removed.

File tests/data/invalid-character.loader-error

  • Ignore whitespace
Binary file added.

File tests/data/invalid-directive-line.error-message

  • Ignore whitespace
-%YAML   1.1 ?   # extra symbol
----

File tests/data/invalid-directive-line.loader-error

View file
  • Ignore whitespace
+%YAML   1.1 ?   # extra symbol
+---

File tests/data/invalid-directive-name-1.error-message

  • Ignore whitespace
-%   # no name at all
----

File tests/data/invalid-directive-name-1.loader-error

View file
  • Ignore whitespace
+%   # no name at all
+---

File tests/data/invalid-directive-name-2.error-message

  • Ignore whitespace
-%invalid-characters:in-directive name
----

File tests/data/invalid-directive-name-2.loader-error

View file
  • Ignore whitespace
+%invalid-characters:in-directive name
+---

File tests/data/invalid-escape-character.error-message

  • Ignore whitespace
-"some escape characters are \ncorrect, but this one \?\nis not\n"

File tests/data/invalid-escape-character.loader-error

View file
  • Ignore whitespace
+"some escape characters are \ncorrect, but this one \?\nis not\n"

File tests/data/invalid-escape-numbers.error-message

  • Ignore whitespace
-"hm.... \u123?"

File tests/data/invalid-escape-numbers.loader-error

View file
  • Ignore whitespace
+"hm.... \u123?"

File tests/data/invalid-indentation-indicator-1.error-message

  • Ignore whitespace
---- >0  # not valid
-data

File tests/data/invalid-indentation-indicator-1.loader-error

View file
  • Ignore whitespace
+--- >0  # not valid
+data

File tests/data/invalid-indentation-indicator-2.error-message

  • Ignore whitespace
---- >-0
-data

File tests/data/invalid-indentation-indicator-2.loader-error

View file
  • Ignore whitespace
+--- >-0
+data

File tests/data/invalid-merge-1.error-message

  • Ignore whitespace
-foo: bar
-<<: baz

File tests/data/invalid-merge-1.loader-error

View file
  • Ignore whitespace
+foo: bar
+<<: baz

File tests/data/invalid-merge-2.error-message

  • Ignore whitespace
-foo: bar
-<<: [x: 1, y: 2, z, t: 4]

File tests/data/invalid-merge-2.loader-error

View file
  • Ignore whitespace
+foo: bar
+<<: [x: 1, y: 2, z, t: 4]

File tests/data/invalid-omap-1.error-message

  • Ignore whitespace
---- !!omap
-foo: bar
-baz: bat

File tests/data/invalid-omap-1.loader-error

View file
  • Ignore whitespace
+--- !!omap
+foo: bar
+baz: bat

File tests/data/invalid-omap-2.error-message

  • Ignore whitespace
---- !!omap
-- foo: bar
-- baz

File tests/data/invalid-omap-2.loader-error

View file
  • Ignore whitespace
+--- !!omap
+- foo: bar
+- baz

File tests/data/invalid-omap-3.error-message

  • Ignore whitespace
---- !!omap
-- foo: bar
-- baz: bar
-  bar: bar

File tests/data/invalid-omap-3.loader-error

View file
  • Ignore whitespace
+--- !!omap
+- foo: bar
+- baz: bar
+  bar: bar

File tests/data/invalid-pairs-1.error-message

  • Ignore whitespace
---- !!pairs
-foo: bar
-baz: bat

File tests/data/invalid-pairs-1.loader-error

View file
  • Ignore whitespace
+--- !!pairs
+foo: bar
+baz: bat

File tests/data/invalid-pairs-2.error-message

  • Ignore whitespace
---- !!pairs
-- foo: bar
-- baz

File tests/data/invalid-pairs-2.loader-error

View file
  • Ignore whitespace
+--- !!pairs
+- foo: bar
+- baz

File tests/data/invalid-pairs-3.error-message

  • Ignore whitespace
---- !!pairs
-- foo: bar
-- baz: bar
-  bar: bar

File tests/data/invalid-pairs-3.loader-error

View file
  • Ignore whitespace
+--- !!pairs
+- foo: bar
+- baz: bar
+  bar: bar

File tests/data/invalid-python-module-kind.loader-error

View file
  • Ignore whitespace
+--- !!python/module:sys { must, be, scalar }

File tests/data/invalid-python-module-value.loader-error

View file
  • Ignore whitespace
+--- !!python/module:sys "non-empty value"

File tests/data/invalid-python-module.loader-error

View file
  • Ignore whitespace
+--- !!python/module:no.such.module

File tests/data/invalid-python-name-kind.loader-error

View file
  • Ignore whitespace
+--- !!python/name:sys.modules {}

File tests/data/invalid-python-name-module-2.loader-error

View file
  • Ignore whitespace
+--- !!python/name:xml.parsers

File tests/data/invalid-python-name-module.loader-error

View file
  • Ignore whitespace
+--- !!python/name:sys.modules.keys

File tests/data/invalid-python-name-object.loader-error

View file
  • Ignore whitespace
+--- !!python/name:os.path.rm_rf

File tests/data/invalid-python-name-value.loader-error

View file
  • Ignore whitespace
+--- !!python/name:sys.modules 5

File tests/data/invalid-simple-key.error-message

  • Ignore whitespace
-key: value
-invalid simple key
-next key: next value

File tests/data/invalid-simple-key.loader-error

View file
  • Ignore whitespace
+key: value
+invalid simple key
+next key: next value

File tests/data/invalid-starting-character.error-message

  • Ignore whitespace
-@@@@@@@@@@@@@@@@@@@

File tests/data/invalid-starting-character.loader-error

View file
  • Ignore whitespace
+@@@@@@@@@@@@@@@@@@@

File tests/data/invalid-tag-1.error-message

  • Ignore whitespace
-- !<foo#bar> baz

File tests/data/invalid-tag-1.loader-error

View file
  • Ignore whitespace
+- !<foo#bar> baz

File tests/data/invalid-tag-2.error-message

  • Ignore whitespace
-- !prefix!foo#bar baz

File tests/data/invalid-tag-2.loader-error

View file
  • Ignore whitespace
+- !prefix!foo#bar baz

File tests/data/invalid-tag-directive-handle.error-message

  • Ignore whitespace
-%TAG !!! !!!
----

File tests/data/invalid-tag-directive-handle.loader-error

View file
  • Ignore whitespace
+%TAG !!! !!!
+---

File tests/data/invalid-tag-directive-prefix.error-message

  • Ignore whitespace
-%TAG    !   tag:zz.com/foo#bar  # '#' is not allowed in URLs
----

File tests/data/invalid-tag-directive-prefix.loader-error

View file
  • Ignore whitespace
+%TAG    !   tag:zz.com/foo#bar  # '#' is not allowed in URLs
+---

File tests/data/invalid-tag-handle-1.error-message

  • Ignore whitespace
-%TAG    foo bar
----

File tests/data/invalid-tag-handle-1.loader-error

View file
  • Ignore whitespace
+%TAG    foo bar
+---

File tests/data/invalid-tag-handle-2.error-message

  • Ignore whitespace
-%TAG    !foo    bar
----

File tests/data/invalid-tag-handle-2.loader-error

View file
  • Ignore whitespace
+%TAG    !foo    bar
+---

File tests/data/invalid-uri-escapes-1.error-message

  • Ignore whitespace
---- !<tag:%x?y> foo

File tests/data/invalid-uri-escapes-1.loader-error

View file
  • Ignore whitespace
+--- !<tag:%x?y> foo

File tests/data/invalid-uri-escapes-2.error-message

  • Ignore whitespace
---- !<%FF> foo

File tests/data/invalid-uri-escapes-2.loader-error

View file
  • Ignore whitespace
+--- !<%FF> foo

File tests/data/invalid-uri-escapes-3.error-message

  • Ignore whitespace
---- !<foo%d0%af%d0%af%d0bar> baz

File tests/data/invalid-uri-escapes-3.loader-error

View file
  • Ignore whitespace
+--- !<foo%d0%af%d0%af%d0bar> baz

File tests/data/invalid-uri.error-message

  • Ignore whitespace
---- !foo!   bar

File tests/data/invalid-uri.loader-error

View file
  • Ignore whitespace
+--- !foo!   bar

File tests/data/invalid-utf8-byte.error-message

  • Ignore whitespace
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
-Invalid byte ('\xFF'): � <--
--------------------------------------------------------------------------------------------------------------------------------

File tests/data/invalid-utf8-byte.loader-error

View file
  • Ignore whitespace
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+Invalid byte ('\xFF'): � <--
+-------------------------------------------------------------------------------------------------------------------------------

File tests/data/invalid-yaml-directive-version-1.error-message

  • Ignore whitespace
-# No version at all.
-%YAML
----

File tests/data/invalid-yaml-directive-version-1.loader-error

View file
  • Ignore whitespace
+# No version at all.
+%YAML
+---

File tests/data/invalid-yaml-directive-version-2.error-message

  • Ignore whitespace
-%YAML   1e-5
----

File tests/data/invalid-yaml-directive-version-2.loader-error

View file
  • Ignore whitespace
+%YAML   1e-5
+---

File tests/data/invalid-yaml-directive-version-3.error-message

  • Ignore whitespace
-%YAML 1.
----

File tests/data/invalid-yaml-directive-version-3.loader-error

View file
  • Ignore whitespace
+%YAML 1.
+---

File tests/data/invalid-yaml-directive-version-4.error-message

  • Ignore whitespace
-%YAML 1.132.435
----

File tests/data/invalid-yaml-directive-version-4.loader-error

View file
  • Ignore whitespace
+%YAML 1.132.435
+---

File tests/data/invalid-yaml-directive-version-5.error-message

  • Ignore whitespace
-%YAML A.0
----

File tests/data/invalid-yaml-directive-version-5.loader-error

View file
  • Ignore whitespace
+%YAML A.0
+---

File tests/data/invalid-yaml-directive-version-6.error-message

  • Ignore whitespace
-%YAML 123.C
----

File tests/data/invalid-yaml-directive-version-6.loader-error

View file
  • Ignore whitespace
+%YAML 123.C
+---

File tests/data/invalid-yaml-version.error-message

  • Ignore whitespace
-%YAML   2.0
---- foo

File tests/data/invalid-yaml-version.loader-error

View file
  • Ignore whitespace
+%YAML   2.0
+--- foo

File tests/data/no-block-collection-end.error-message

  • Ignore whitespace
-- foo
-- bar
-baz: bar

File tests/data/no-block-collection-end.loader-error

View file
  • Ignore whitespace
+- foo
+- bar
+baz: bar

File tests/data/no-block-mapping-end.error-message

  • Ignore whitespace
-foo: "bar" "baz"

File tests/data/no-block-mapping-end.loader-error

View file
  • Ignore whitespace
+foo: "bar" "baz"

File tests/data/no-document-start.error-message

  • Ignore whitespace
-%YAML   1.1
-# no ---
-foo: bar

File tests/data/no-document-start.loader-error

View file
  • Ignore whitespace
+%YAML   1.1
+# no ---
+foo: bar

File tests/data/no-flow-mapping-end.error-message

  • Ignore whitespace
-{ foo: bar ]

File tests/data/no-flow-mapping-end.loader-error

View file
  • Ignore whitespace
+{ foo: bar ]

File tests/data/no-flow-sequence-end.error-message

  • Ignore whitespace
-[foo, bar}

File tests/data/no-flow-sequence-end.loader-error

View file
  • Ignore whitespace
+[foo, bar}

File tests/data/no-node-1.error-message

  • Ignore whitespace
-- !foo ]

File tests/data/no-node-1.loader-error

View file
  • Ignore whitespace
+- !foo ]

File tests/data/no-node-2.error-message

  • Ignore whitespace
-- [ !foo } ]

File tests/data/no-node-2.loader-error

View file
  • Ignore whitespace
+- [ !foo } ]

File tests/data/recursive-anchor.error-message

  • Ignore whitespace
-- &foo [1
-    2,
-    3,
-    *foo]

File tests/data/recursive-anchor.loader-error

View file
  • Ignore whitespace
+- &foo [1
+    2,
+    3,
+    *foo]

File tests/data/unacceptable-key.error-message

  • Ignore whitespace
----
-? - foo
-  - bar
-: baz

File tests/data/unacceptable-key.loader-error

View file
  • Ignore whitespace
+---
+? - foo
+  - bar
+: baz

File tests/data/unclosed-bracket.error-message

  • Ignore whitespace
-test:
-    - [ foo: bar
-# comment the rest of the stream to let the scanner detect the problem.
-#    - baz
-#"we could have detected the unclosed bracket on the above line, but this would forbid such syntax as": {
-#}

File tests/data/unclosed-bracket.loader-error

View file
  • Ignore whitespace
+test:
+    - [ foo: bar
+# comment the rest of the stream to let the scanner detect the problem.
+#    - baz
+#"we could have detected the unclosed bracket on the above line, but this would forbid such syntax as": {
+#}

File tests/data/unclosed-quoted-scalar.error-message

  • Ignore whitespace
-'foo
- bar

File tests/data/unclosed-quoted-scalar.loader-error

View file
  • Ignore whitespace
+'foo
+ bar

File tests/data/undefined-anchor.error-message

  • Ignore whitespace
-- foo
-- &bar baz
-- *bat

File tests/data/undefined-anchor.loader-error

View file
  • Ignore whitespace
+- foo
+- &bar baz
+- *bat

File tests/data/undefined-constructor.error-message

  • Ignore whitespace
---- !foo bar

File tests/data/undefined-constructor.loader-error

View file
  • Ignore whitespace
+--- !foo bar

File tests/data/undefined-tag-handle.error-message

  • Ignore whitespace
---- !foo!bar    baz

File tests/data/undefined-tag-handle.loader-error

View file
  • Ignore whitespace
+--- !foo!bar    baz

File tests/test_errors.py

View file
  • Ignore whitespace
 
 class TestErrors(test_appliance.TestAppliance):
 
-    def _testErrors(self, test_name, invalid_filename):
+    def _testLoaderErrors(self, test_name, invalid_filename):
         #self._load(invalid_filename)
         self.failUnlessRaises(YAMLError, lambda: self._load(invalid_filename))
 
-    def _testStringErrors(self, test_name, invalid_filename):
+    def _testLoaderStringErrors(self, test_name, invalid_filename):
         #self._load_string(invalid_filename)
         self.failUnlessRaises(YAMLError, lambda: self._load_string(invalid_filename))
 
             #print "%s:" % exc.__class__.__name__, exc
             raise
 
-TestErrors.add_tests('testErrors', '.error-message')
-TestErrors.add_tests('testStringErrors', '.error-message')
+TestErrors.add_tests('testLoaderErrors', '.loader-error')
+TestErrors.add_tests('testLoaderStringErrors', '.loader-error')