updated the organic name when creating the object#45
Conversation
updated the organic name when creating the object
Now when you create a measurement object the unit is converted to the most optimal
for example, if you declare Capacitance('0.0001 F'), it returns the object Capacitance('100 uF')
I recommend calling the function self.update_org_name() after calculations or before printing the value on the screen
|
Hi @SasoriOlkof, that is a great idea! I'd love to see this included in version 4. Would you mind adding tests for the new function and maybe an integration test to verify the overall behavior. Once you are done and all checks pass, simply click the "Ready for review" button. |
|
Hello, Sorry, I don't know how the tests work 😁, what do I have to add? |
|
something like that is enough? |
|
I think that's fine now :) |
codingjoe
left a comment
There was a problem hiding this comment.
Hi @SasoriOlkof you are off to a good start however, there is still much to do.
Only Unit and MetricUnit implement Unit.factor, DegreeUnit for temperatures does not.
You also cast the factor to a float at one point. I don't think that wise, considering we use decimals for a reason here.
Also, plenty of other tests are failing. If you need any help, please let me know.
Best,
Joe
|
I see, keep the floats then for now. Let me know if you need any assistance in fixing the remaining issues in the test suite. Please also remember to add tests for negative example, where you code should not be executed. Best Joe |


updated the organic name when creating the object
Now when you create a measurement object the unit is converted to the most optimal
for example, if you declare Capacitance('0.0001 F'), it returns the object Capacitance('100 uF')
I recommend calling the function self.update_org_name() after calculations or before printing the value on the screen