language-python icon indicating copy to clipboard operation
language-python copied to clipboard

Quoter

Open Pagolin opened this issue 4 years ago • 5 comments

I needed a Quasiquoter, so I added a simple one (basically a wrapper for dataToExp. I had the existing test running through, with obviously no error, but didn't manage to add tests yet. However I thought it might be useful for someone.

Pagolin avatar Jul 30 '21 16:07 Pagolin

This looks great. Can you please show some examples of its use? Maybe some examples can be put in the header documentation for Language.Python.Common.Quoter?

bjpop avatar Jul 31 '21 12:07 bjpop

Like so?

Pagolin avatar Aug 04 '21 12:08 Pagolin

Looks great thanks! Would it be possible to add some test cases to the test suite as well?

bjpop avatar Aug 05 '21 00:08 bjpop

I thought about how to test this. I could compare a) quotes to parse results from files using the test python already there or b) compare quotes to 'handcrafted' (sub)AST.

Pagolin avatar Aug 05 '21 06:08 Pagolin

Hi @Pagolin.

I would like to pull this code into the repository.

I do prefer to have some test cases to use when doing the pull. Your suggested approach sounds reasonable. I find that testing against hand written ASTs can be a bit laborious, and thus few tests get written this way.

Another approach is to do a kind of "round trip" testing, by quoting some code, then pretty printing it back to a rendered string, and then comparing that string to the expected code.

This is not perfect, because it relies on the pretty printer being stable, and it is not in the spirit of a unit test. However, it tends to be easier to do, and therefore more tests can get written, which has its own advantages.

bjpop avatar Aug 19 '21 02:08 bjpop