Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Tests depend on deterministic ordering of attributes #2

Closed
rowanseymour opened this issue Oct 12, 2016 · 5 comments
Closed

Tests depend on deterministic ordering of attributes #2

rowanseymour opened this issue Oct 12, 2016 · 5 comments

Comments

@rowanseymour
Copy link
Member

attributes_dict = eval(attribute_dict_string)
evaluates a parsed attribute dictionary as a Python dict, but that means attribute ordering is non-deterministic.

This leads to tests sometimes failing which depend on order, e.g.

eq_(sut.attributes, "a='something' c='2' b")

Question is whether html attribute order should match haml attribute order?

@Psycojoker
Copy link
Collaborator

I think that we should try to finish this other branch https://github.com/Psycojoker/django-hamlpy/tree/element_parser that, apparently, uses a real parser. This will solve this issue and avoid potential other ones generated by using regex to transform the attributes into a python dict.

@rowanseymour
Copy link
Member Author

Yeah the regex approach is certainly fragile... do you know how close to finished that branch is?

@Psycojoker
Copy link
Collaborator

Sadly no, I've only saw it since someone proposed it to be merged jessemiller#147 so I guess it's at least close to being ready.

@rowanseymour
Copy link
Member Author

Looks like it has diverged quite a bit from master and doesn't run on Python 2.7.

How would you feel about this as temporary workaround 9e53689 ?

@Psycojoker
Copy link
Collaborator

This fix seems totally acceptable in this situation for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants