Skip to content

Commit

Permalink
test sudachi-synonym-dictionary: reduce checking
Browse files Browse the repository at this point in the history
GitHub: red-data-toolsGH-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
```
  • Loading branch information
tikkss committed Sep 8, 2024
1 parent c4177ec commit d900a15
Showing 1 changed file with 12 additions and 31 deletions.
43 changes: 12 additions & 31 deletions test/test-sudachi-synonym-dictionary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,18 @@ def setup
end

test('#each') do
records = @dataset.each.to_a
assert_equal([
67753,
{
group_id: "000001",
is_noun: true,
expansion_type: :always,
lexeme_id: 1,
form_type: :typical,
acronym_type: :typical,
variant_type: :typical,
categories: [],
notation: "曖昧",
},
{
group_id: "026068",
is_noun: true,
expansion_type: :always,
lexeme_id: 1,
form_type: :typical,
acronym_type: :others,
variant_type: :typical,
categories: ["IT"],
notation: "サ終",
},
],
[
records.size,
records[0].to_h,
records[-1].to_h,
])
assert_equal({
group_id: "000001",
is_noun: true,
expansion_type: :always,
lexeme_id: 1,
form_type: :typical,
acronym_type: :typical,
variant_type: :typical,
categories: [],
notation: "曖昧",
},
@dataset.each.next.to_h)
end

sub_test_case('#metadata') do
Expand Down

0 comments on commit d900a15

Please sign in to comment.