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

table tests need TLC #107

Open
pfuntner opened this issue Sep 23, 2023 · 2 comments
Open

table tests need TLC #107

pfuntner opened this issue Sep 23, 2023 · 2 comments

Comments

@pfuntner
Copy link
Owner

I was revisiting table/tests.py and noticed it was in bad need of work:

  • It was using Python 2
  • It wasn't using f-strings

I put in a bit of work and got rid of syntax errors (66d2dda) but it's claiming there are failures:

$ table/test.py 
Testing ls
2023-09-23 10:09:47,520 CRITICAL /ExtraVolume/repos/toys/test/table/test.py:29 xml -> xml mismatch
$

I took a look and I think it's working correctly:

$ diff <(table -i fixed -o xml < table/ls/original.txt | html) <(table -i fixed -o xml < table/ls/original.txt | table -i xml -o xml | html)
$ table -i fixed -o xml < table/ls/original.txt | html | head
<table>
  <row>
    <col00000000>perms
    </col00000000>
    <col00000001>l
    </col00000001>
    <col00000002>user
    </col00000002>
    <col00000003>group
    </col00000003>
$ 

However the expected output is different:

$ html < table/ls/xml/xml/noheadings.expected | head
<table>
  <row>
    <col00000005>datetime
    </col00000005>
    <col00000004>size
    </col00000004>
    <col00000006>name
    </col00000006>
    <col00000001>l
    </col00000001>

The columns are clearly in a different order... it shouldn't make a difference in the XML but it's throwing the test off. I actually prefer the new behavior so the expected output file needs to be updated. I know I periodically add features and tweaks to table.py - I even added something to not sort dictionary keys but it shouldn't have changed this (famous last words!).

@pfuntner
Copy link
Owner Author

pfuntner commented Oct 1, 2023

I wonder if I need to regenerate all the test data. I could write a script to do that! I must have had a script to do it originally. I don't think I saved it, however.

@pfuntner
Copy link
Owner Author

pfuntner commented Mar 9, 2024

This could be a dupe of #94

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

1 participant