-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Fix #1230. Fix word2vec reset_from bug in v1.0.1 and added unittest #1234
Changes from 32 commits
1c63c9a
280a488
ddeb002
f2ac3a9
cf09e8c
b61287a
3ade404
9e6522e
87c4e9c
9c74b40
7b30025
de79c8e
d4f9cc5
d8e9c0f
7c118fc
432f840
b42e181
3067cb0
e838391
5d47ec4
a18de8d
67b1a17
df13670
78da89a
fb3f303
adc447d
333fd4d
f3f6c20
faf6847
520d89e
9449d06
5c3aca6
e00a861
8e82566
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -678,6 +678,16 @@ def test_sentences_should_not_be_a_generator(self): | |
def testLoadOnClassError(self): | ||
"""Test if exception is raised when loading word2vec model on instance""" | ||
self.assertRaises(AttributeError, load_on_instance) | ||
|
||
def test_reset_from(self): | ||
"""Test if exception is raised when reset_from is used""" | ||
model = word2vec.Word2Vec(sentences, min_count=1) | ||
model2 = word2vec.Word2Vec(new_sentences, min_count=1) | ||
try: | ||
model.reset_from(model2) | ||
except AttributeError: | ||
self.fail('AttributeError in reset_from()') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is the purpose of this line? what would be different if it was removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because an uncaught error will result in a test failure, this catch-then-fail seems superfluous - it's enough to try the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, it is not needed and I just updated the test. |
||
|
||
#endclass TestWord2VecModel | ||
|
||
class TestWMD(unittest.TestCase): | ||
|
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.
is there some reason that exception should be raised when reset_from is used? correct behavious is no exception. please add checks that the model is actually reset.