Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First pass at attempting to parse YAML 1.2 #489

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
59eec9a
install_requires
dHannasch Feb 4, 2021
ecdeaf7
install_requires=
dHannasch Feb 4, 2021
e479236
temporarily include ruyaml until can get the parser until pyyaml
dHannasch Feb 4, 2021
4669dad
add kwarg to safe_load
dHannasch Feb 4, 2021
a7b82df
Drop Python 2.7 support.
dHannasch Feb 4, 2021
b02ee41
remove the Mac test for 2.7 as well
dHannasch Feb 4, 2021
3d4faef
Merge branch 'drop-python-2.7-support' into first-attempt-parsing-YAM…
dHannasch Feb 4, 2021
320799a
setup() imports test_all imports yaml so no dependencies can be insta…
dHannasch Feb 4, 2021
cdd1c3a
Remove py27.
dHannasch Feb 4, 2021
992ea3c
test_recursive_12
dHannasch Feb 5, 2021
6c7966a
Install before test.
dHannasch Feb 5, 2021
2279e5f
Merge branch 'install-before-test' into first-attempt-parsing-YAML-1.2
dHannasch Feb 5, 2021
7ba163b
Use pip in the Makefile, like the packaging/build scripts already do.
dHannasch Feb 5, 2021
2c1ce60
Merge branch 'use-pip-to-install' into first-attempt-parsing-YAML-1.2
dHannasch Feb 5, 2021
c01b0b1
Drop Python 2.7 from Windows.
dHannasch Feb 5, 2021
60b27c4
Use pip on AppVeyor as well.
dHannasch Feb 5, 2021
5e23886
Merge branch 'drop-python-2.7-support' into use-pip-to-install
dHannasch Feb 5, 2021
433dc2b
Merge branch 'use-pip-to-install' into first-attempt-parsing-YAML-1.2
dHannasch Feb 5, 2021
fb1580c
need to do this in two steps
dHannasch Feb 5, 2021
76cbcb9
--with-libyaml probably irrelevant with --editable
dHannasch Feb 5, 2021
60675c0
build before test
dHannasch Feb 5, 2021
3eec227
check libyaml after reinstall
dHannasch Feb 5, 2021
2b36a0e
setup.py test does manual path-hacking to get the build directory
dHannasch Feb 5, 2021
09858fd
Merge branch 'use-pip-to-install' into first-attempt-parsing-YAML-1.2
dHannasch Feb 5, 2021
22f6fbe
Add sanity-check tests that are installed with the library and can be…
dHannasch Feb 5, 2021
1441fba
Merge branch 'install-before-test' into tests-installed-with-lib-for-…
dHannasch Feb 5, 2021
c4438ca
pytest --pyargs yaml
dHannasch Feb 5, 2021
3709468
pip install pytest
dHannasch Feb 5, 2021
1829e4c
Merge branch 'use-pip-to-install' into tests-installed-with-lib-for-s…
dHannasch Feb 5, 2021
bd9b73e
Merge branch 'tests-installed-with-lib-for-sanity-check' into first-a…
dHannasch Feb 5, 2021
6a1a26f
Use YAML 1.2 Loader and Dumper for these tests
dHannasch Feb 5, 2021
0629ce2
add YAML12Loader
dHannasch Feb 5, 2021
3974271
just use YAML12SafeLoader
dHannasch Feb 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use YAML 1.2 Loader and Dumper for these tests
dHannasch committed Feb 5, 2021
commit 6a1a26f1b851ec59723132e6daa5b7dc818585bf
16 changes: 8 additions & 8 deletions lib3/yaml/tests/test_add_xxx.py
Original file line number Diff line number Diff line change
@@ -29,15 +29,15 @@ def test_dice_constructor():
import yaml # NOQA

yaml.add_constructor(u'!dice', dice_constructor)
data = yaml.load('initial hit points: !dice 8d4', Loader=yaml.Loader)
data = yaml.load('initial hit points: !dice 8d4', Loader=yaml.YAML12Loader)
assert str(data) == "{'initial hit points': Dice(8,4)}"


def test_dice_constructor_with_loader():
import yaml # NOQA

yaml.add_constructor(u'!dice', dice_constructor, Loader=yaml.Loader)
data = yaml.load('initial hit points: !dice 8d4', Loader=yaml.Loader)
yaml.add_constructor(u'!dice', dice_constructor, Loader=yaml.YAML12Loader)
data = yaml.load('initial hit points: !dice 8d4', Loader=yaml.YAML12Loader)
assert str(data) == "{'initial hit points': Dice(8,4)}"


@@ -60,7 +60,7 @@ def test_dice_implicit_resolver():
yaml.dump(dict(treasure=Dice(10, 20)), default_flow_style=False)
== 'treasure: 10d20\n'
)
assert yaml.load('damage: 5d10', Loader=yaml.Loader) == dict(damage=Dice(5, 10))
assert yaml.load('damage: 5d10', Loader=yaml.YAML12Loader) == dict(damage=Dice(5, 10))


class Obj1(dict):
@@ -102,19 +102,19 @@ def test_yaml_obj():

yaml.add_representer(Obj1, YAMLObj1.to_yaml)
yaml.add_multi_constructor(YAMLObj1.yaml_tag, YAMLObj1.from_yaml)
x = yaml.load('!obj:x.2\na: 1', Loader=yaml.Loader)
x = yaml.load('!obj:x.2\na: 1', Loader=yaml.YAML12Loader)
print(x)
assert yaml.dump(x) == """!obj:x.2 "{'a': 1}"\n"""


def test_yaml_obj_with_loader_and_dumper():
import yaml # NOQA

yaml.add_representer(Obj1, YAMLObj1.to_yaml, Dumper=yaml.Dumper)
yaml.add_representer(Obj1, YAMLObj1.to_yaml, Dumper=yaml.YAML12Dumper)
yaml.add_multi_constructor(
YAMLObj1.yaml_tag, YAMLObj1.from_yaml, Loader=yaml.Loader
YAMLObj1.yaml_tag, YAMLObj1.from_yaml, Loader=yaml.YAML12Loader
)
x = yaml.load('!obj:x.2\na: 1', Loader=yaml.Loader)
x = yaml.load('!obj:x.2\na: 1', Loader=yaml.YAML12Loader)
print(x)
assert yaml.dump(x) == """!obj:x.2 "{'a': 1}"\n"""