-
Notifications
You must be signed in to change notification settings - Fork 166
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
Encode categorical column #770
Encode categorical column #770
Conversation
5cfd109
to
9989370
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to just be testing json.dumps
is there not a new function / method on classes that we want to test here?
exepcted = json.dumps( | ||
{ | ||
"name": profile.name, | ||
"col_index": profile.col_index, | ||
"sample_size": profile.sample_size, | ||
"metadata": profile.metadata, | ||
"times": profile.times, | ||
"thread_safe": profile.thread_safe, | ||
"_categories": profile._categories, | ||
"_CategoricalColumn__calculations": {}, | ||
"_top_k_categories": profile._top_k_categories, | ||
} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend making this more test-driven development.. instead of assigning expected
values from the profile object itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah instead of using the profile.
these values should be literals. This is to prevent changes from going under the radar and forcing the test to have specific values, rather than change with your profile object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as my comment above
profile.update(df_categorical) | ||
|
||
serialized = json.dumps(profile, cls=ProfileEncoder) | ||
exepcted = json.dumps( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected
typo
} | ||
) | ||
|
||
self.assertEqual(json.loads(serialized), json.loads(expected)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we are trying to test the functionality of encoding and decoding (profile -> json -> profile) then I think that the assertEqual() should be comparing the decoded data (json -> profile) to another profile object that represents the object we expect as a result.
exepcted = json.dumps( | ||
{ | ||
"name": profile.name, | ||
"col_index": profile.col_index, | ||
"sample_size": profile.sample_size, | ||
"metadata": profile.metadata, | ||
"times": profile.times, | ||
"thread_safe": profile.thread_safe, | ||
"_categories": profile._categories, | ||
"_CategoricalColumn__calculations": {}, | ||
"_top_k_categories": profile._top_k_categories, | ||
} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as my comment above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs a couple tweaks prior to merging
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
No description provided.