Skip to content

Commit

Permalink
minor format updates
Browse files Browse the repository at this point in the history
  • Loading branch information
qiyanjun committed Jun 6, 2022
1 parent 578367d commit 3e30662
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/test_attacked_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def test_window_around_index(self, attacked_text):

def test_big_window_around_index(self, attacked_text):
assert (
attacked_text.text_window_around_index(0, 10**5) + "."
attacked_text.text_window_around_index(0, 10 ** 5) + "."
) == attacked_text.text

def test_window_around_index_start(self, attacked_text):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_command_line/test_attack.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
),
# fmt: on
#
# # test: run_attack on LSTM MR using word embedding transformation and genetic algorithm.
# # test: run_attack on LSTM MR using word embedding transformation and genetic algorithm.
## Simulate alzantot recipe without using expensive LM (still too slow)
# (
# "run_attack_faster_alzantot_recipe",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_word_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def test_embedding_paragramcf():
word_embedding = WordEmbedding.counterfitted_GLOVE_embedding()
assert pytest.approx(word_embedding[0][0]) == -0.022007
assert pytest.approx(word_embedding["fawn"][0]) == -0.022007
assert word_embedding[10**9] is None
assert word_embedding[10 ** 9] is None


def test_embedding_gensim():
Expand All @@ -37,7 +37,7 @@ def test_embedding_gensim():
word_embedding = GensimWordEmbedding(keyed_vectors)
assert pytest.approx(word_embedding[0][0]) == 1
assert pytest.approx(word_embedding["bye-bye"][0]) == -1 / np.sqrt(2)
assert word_embedding[10**9] is None
assert word_embedding[10 ** 9] is None

# test query functionality
assert pytest.approx(word_embedding.get_cos_sim(1, 3)) == 0
Expand Down

0 comments on commit 3e30662

Please sign in to comment.