Skip to content

Commit 6723879

Browse files
authored
test sudachi-synonym-dictionary: reduce checking (#225)
GitHub: GH-188 Because csv file is too big (67,753 rows). Before this change: ```console $ time ruby test/run-test.rb -t SudachiSynonymDictionaryTest --verbose=important-only Finished in 1.296801 seconds. 2 tests, 2 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications real 0m1.964s user 0m1.740s sys 0m0.118s ``` After this change: ```console $ time ruby test/run-test.rb -t SudachiSynonymDictionaryTest --verbose=important-only Finished in 0.010658 seconds. 2 tests, 2 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications real 0m0.634s user 0m0.455s sys 0m0.092s ```
1 parent c4177ec commit 6723879

File tree

1 file changed

+12
-31
lines changed

1 file changed

+12
-31
lines changed

test/test-sudachi-synonym-dictionary.rb

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,18 @@ def setup
44
end
55

66
test('#each') do
7-
records = @dataset.each.to_a
8-
assert_equal([
9-
67753,
10-
{
11-
group_id: "000001",
12-
is_noun: true,
13-
expansion_type: :always,
14-
lexeme_id: 1,
15-
form_type: :typical,
16-
acronym_type: :typical,
17-
variant_type: :typical,
18-
categories: [],
19-
notation: "曖昧",
20-
},
21-
{
22-
group_id: "026068",
23-
is_noun: true,
24-
expansion_type: :always,
25-
lexeme_id: 1,
26-
form_type: :typical,
27-
acronym_type: :others,
28-
variant_type: :typical,
29-
categories: ["IT"],
30-
notation: "サ終",
31-
},
32-
],
33-
[
34-
records.size,
35-
records[0].to_h,
36-
records[-1].to_h,
37-
])
7+
assert_equal({
8+
group_id: "000001",
9+
is_noun: true,
10+
expansion_type: :always,
11+
lexeme_id: 1,
12+
form_type: :typical,
13+
acronym_type: :typical,
14+
variant_type: :typical,
15+
categories: [],
16+
notation: "曖昧",
17+
},
18+
@dataset.each.next.to_h)
3819
end
3920

4021
sub_test_case('#metadata') do

0 commit comments

Comments
 (0)