-
-
Notifications
You must be signed in to change notification settings - Fork 236
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
Add DefaultFormatter.EnableScientific #190
Comments
hi @gavv , can I work on this? thanks |
Sure! |
thanks will make progress within this week |
hi @gavv in httpexpect we have this Line 394 in 0bdec41
question: is the scope of this change only within " because it looks like thanks |
Good question. formatFloat is used only for printing delta when use use assertions like EqualDelta. This feature is definitely broader than just printing deltas, it should apply to actual and expected values in all assertion types. Actually I don't quite understand why I added formatFloat. It seems misleading, because most times it's not used for formatting floats.. I think we should remove formatFloat at all and instead use formatValue and teach formatValue to print floats as formatFloat does it. Also, as you correctly noticed, numbers may be printed via formatRange. Let's rework formatRange so that it will use formatValue to format min and max; this way all float formatting logic will be in one place - in formatValue. Similarly, we should rework formatTyped to use formatValue when value is a number. |
Also, after more thought, it seems that it's better to reverse the option: add DisableScientific instead of EnableScientific. It would work as follows:
|
ok, noted so |
agree btw it looks like we don't have unit test for |
most of the tests in |
maybe we can test the Line 141 in 0bdec41
IMO on the contrary...if we assert the Line 134 in 0bdec41
wdyt? |
Yes.
We have a basic test in TestE2EReportNames, and an issue for expanding them: #165 However they are e2e tests that cover formatter very shallow and indirectly (thought I still think they would be helpful anyway).
This sound like a very good idea, I didn't think about it. And such tests would be extra valuable since FormatData is part of public API and currently it's not covered at all. |
it looks like #165 idea is (quite) similar with asserting the yea, maybe asserting the |
ok, i think i will do these changes in order
i will start the PR(s) as draft thanks |
Great, sounds good. Yes, I think it makes sense to add both set of tests - described in #165 that match resulting text, and what you described here that match FormatData. First set of tests will check the end result that is presented to user and will cover template formatter as well. Second will be more low-level and more granular, and wont bother about templates. After completing this issue we may create a new one for adding more formatter unit tests based on FormatData. |
got it |
@gavv Hi, I just realised this. How do we pass the
Maybe, we can add a new parameter to Something like:
Btw, this idea is referencing this statement:
Wdyt? Thanks |
We could make all formatXxx methods of formatter. Why:
|
Happy new year btw :) |
ok, it looks like that would result to a lot of changes but it is ok because we have the time i will create a draft PR first, consisting:
|
happy new year to all of httpexpect contributors 🚀 |
This issue needs additional work of adding unit test
ref: #220 (comment) |
Fixed in d9300b9 |
Everything is merged |
I've created a follow-up issue: #258 |
Add flag EnableScientific to DefaultFormatter that enables printing floats in scientific form. Without this flag, floats should be always printed in non-scientific form.
See also #160 and #159.
The text was updated successfully, but these errors were encountered: