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

[PATCH] Failing test for set round-tripping #3

Closed
rmunn opened this issue Apr 7, 2014 · 2 comments
Closed

[PATCH] Failing test for set round-tripping #3

rmunn opened this issue Apr 7, 2014 · 2 comments

Comments

@rmunn
Copy link

rmunn commented Apr 7, 2014

One of the round-trip tests failed the first time I ran it:

rmunn@laptop:~/code/python/edn_format (master)$ python tests.py 
......F.
======================================================================
FAIL: test_round_trip_conversion (__main__.EdnTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 140, in test_round_trip_conversion
    self.assertIn(step3, literal[1])
AssertionError: '#{:b (1 2 3) :a}' not found in ['#{:a (1 2 3) :b}', '#{(1 2 3) :a :b}', '#{:a :b (1 2 3)}', '#{:b :a (1 2 3)}']

----------------------------------------------------------------------
Ran 8 tests in 0.447s

FAILED (failures=1)

There are six possible permutations of :a, :b, and (1 2 3), but only four of those permutations are checked for in the test results. The following patch will check for the other two possible permutations:

diff --git a/tests.py b/tests.py
index df26228..6a272ab 100644
--- a/tests.py
+++ b/tests.py
@@ -126,7 +126,9 @@ class EdnTest(unittest.TestCase):
             ["+32.23M", "32.23M"],
             ["3.23e10", "32300000000.0"],
             ['#{:a (1 2 3) :b}', ['#{:a (1 2 3) :b}',
+                                  '#{:b (1 2 3) :a}',
                                   '#{(1 2 3) :a :b}',
+                                  '#{(1 2 3) :b :a}',
                                   '#{:a :b (1 2 3)}',
                                   '#{:b :a (1 2 3)}']]
         ]

The patch is simple enough that I'm not going to bother with setting up a pull request, though I can do so if you'd prefer.

@kurtraschke
Copy link
Owner

Did you mean to report this against swaroopch/edn_format?

@rmunn
Copy link
Author

rmunn commented Apr 8, 2014

Yes, I did; I mixed up my open tabs. My apologies for the unintentional spam.

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

No branches or pull requests

2 participants