Skip to content

Commit

Permalink
SQL test_filter replace RowInstance with Instance
Browse files Browse the repository at this point in the history
  • Loading branch information
PrimozGodec committed Dec 15, 2020
1 parent 87446cb commit b408ba7
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions Orange/tests/sql/test_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import unittest

from Orange.data.sql.table import SqlTable, SqlRowInstance
from Orange.data import filter, domain
from Orange.data.sql.table import SqlTable
from Orange.data import filter, domain, Instance
from Orange.tests.sql.base import DataBaseTest as dbt


Expand Down Expand Up @@ -368,7 +368,7 @@ def test_filter_string_is_defined(self):
filtered_data = filter.Values(conditions=[
filter.FilterString(-1, filter.FilterString.IsDefined)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data if row[0] is not None]

self.assertEqual(len(filtered_data), len(correct_data))
Expand All @@ -379,7 +379,7 @@ def test_filter_string_equal(self):
filtered_data = filter.Values(conditions=[
filter.FilterString(-1, filter.FilterString.Equal, 'in')
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data if row[0] == 'in']

self.assertEqual(len(filtered_data), len(correct_data))
Expand All @@ -391,7 +391,7 @@ def test_filter_string_equal_case_insensitive_value(self):
filter.FilterString(-1, filter.FilterString.Equal, 'In',
case_sensitive=False)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data if row[0] == 'in']

self.assertEqual(len(filtered_data), len(correct_data))
Expand All @@ -403,7 +403,7 @@ def test_filter_string_equal_case_insensitive_data(self):
filter.FilterString(-1, filter.FilterString.Equal, 'donec',
case_sensitive=False)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data if row[0] == 'Donec']

self.assertEqual(len(filtered_data), len(correct_data))
Expand All @@ -414,7 +414,7 @@ def test_filter_string_not_equal(self):
filtered_data = filter.Values(conditions=[
filter.FilterString(-1, filter.FilterString.NotEqual, 'in')
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data if row[0] != 'in']

self.assertEqual(len(filtered_data), len(correct_data))
Expand All @@ -426,7 +426,7 @@ def test_filter_string_not_equal_case_insensitive_value(self):
filter.FilterString(-1, filter.FilterString.NotEqual, 'In',
case_sensitive=False)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data if row[0] != 'in']

self.assertEqual(len(filtered_data), len(correct_data))
Expand All @@ -438,7 +438,7 @@ def test_filter_string_not_equal_case_insensitive_data(self):
filter.FilterString(-1, filter.FilterString.NotEqual, 'donec',
case_sensitive=False)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data if row[0] != 'Donec']

self.assertEqual(len(filtered_data), len(correct_data))
Expand All @@ -449,7 +449,7 @@ def test_filter_string_less(self):
filtered_data = filter.Values(conditions=[
filter.FilterString(-1, filter.FilterString.Less, 'A')
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and row[0] < 'A']

Expand All @@ -462,7 +462,7 @@ def test_filter_string_less_case_insensitive_value(self):
filter.FilterString(-1, filter.FilterString.Less, 'In',
case_sensitive=False)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and row[0].lower() < 'in']

Expand All @@ -475,7 +475,7 @@ def test_filter_string_less_case_insensitive_data(self):
filter.FilterString(-1, filter.FilterString.Less, 'donec',
case_sensitive=False)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and row[0].lower() < 'donec']

Expand All @@ -487,7 +487,7 @@ def test_filter_string_less_equal(self):
filtered_data = filter.Values(conditions=[
filter.FilterString(-1, filter.FilterString.LessEqual, 'A')
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and row[0] <= 'A']

Expand All @@ -500,7 +500,7 @@ def test_filter_string_less_equal_case_insensitive_value(self):
filter.FilterString(-1, filter.FilterString.LessEqual, 'In',
case_sensitive=False)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and row[0].lower() <= 'in']

Expand All @@ -513,7 +513,7 @@ def test_filter_string_less_equal_case_insensitive_data(self):
filter.FilterString(-1, filter.FilterString.LessEqual, 'donec',
case_sensitive=False)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and row[0].lower() <= 'donec']

Expand All @@ -525,7 +525,7 @@ def test_filter_string_greater(self):
filtered_data = filter.Values(conditions=[
filter.FilterString(-1, filter.FilterString.Greater, 'volutpat')
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and row[0] > 'volutpat']

Expand All @@ -538,7 +538,7 @@ def test_filter_string_greater_case_insensitive_value(self):
filter.FilterString(-1, filter.FilterString.Greater, 'In',
case_sensitive=False)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and row[0].lower() > 'in']

Expand All @@ -551,7 +551,7 @@ def test_filter_string_greater_case_insensitive_data(self):
filter.FilterString(-1, filter.FilterString.Greater, 'donec',
case_sensitive=False)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and row[0].lower() > 'donec']

Expand All @@ -563,7 +563,7 @@ def test_filter_string_greater_equal(self):
filtered_data = filter.Values(conditions=[
filter.FilterString(-1, filter.FilterString.GreaterEqual, 'volutpat')
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and row[0] >= 'volutpat']

Expand All @@ -576,7 +576,7 @@ def test_filter_string_greater_equal_case_insensitive_value(self):
filter.FilterString(-1, filter.FilterString.GreaterEqual, 'In',
case_sensitive=False)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and row[0].lower() >= 'in']

Expand All @@ -589,7 +589,7 @@ def test_filter_string_greater_equal_case_insensitive_data(self):
filter.FilterString(-1, filter.FilterString.GreaterEqual, 'donec',
case_sensitive=False)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and row[0].lower() >= 'donec']

Expand All @@ -601,7 +601,7 @@ def test_filter_string_between(self):
filtered_data = filter.Values(conditions=[
filter.FilterString(-1, filter.FilterString.Between, 'a', 'c')
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and 'a' <= row[0] <= 'c']

Expand All @@ -614,7 +614,7 @@ def test_filter_string_between_case_insensitive_value(self):
filter.FilterString(-1, filter.FilterString.Between, 'I', 'O',
case_sensitive=False)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and 'i' < row[0].lower() <= 'o']

Expand All @@ -627,7 +627,7 @@ def test_filter_string_between_case_insensitive_data(self):
filter.FilterString(-1, filter.FilterString.Between, 'i', 'O',
case_sensitive=False)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and 'i' <= row[0].lower() <= 'o']

Expand All @@ -639,7 +639,7 @@ def test_filter_string_contains(self):
filtered_data = filter.Values(conditions=[
filter.FilterString(-1, filter.FilterString.Contains, 'et')
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and 'et' in row[0]]

Expand All @@ -652,7 +652,7 @@ def test_filter_string_contains_case_insensitive_value(self):
filter.FilterString(-1, filter.FilterString.Contains, 'eT',
case_sensitive=False)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and 'et' in row[0].lower()]

Expand All @@ -665,7 +665,7 @@ def test_filter_string_contains_case_insensitive_data(self):
filter.FilterString(-1, filter.FilterString.Contains, 'do',
case_sensitive=False)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and 'do' in row[0].lower()]

Expand All @@ -677,7 +677,7 @@ def test_filter_string_outside(self):
filtered_data = filter.Values(conditions=[
filter.FilterString(-1, filter.FilterString.Outside, 'am', 'di')
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and not 'am' < row[0] < 'di']

Expand All @@ -690,7 +690,7 @@ def test_filter_string_outside_case_insensitive(self):
filter.FilterString(-1, filter.FilterString.Outside, 'd', 'k',
case_sensitive=False)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and not 'd' < row[0].lower() < 'k']

Expand All @@ -702,7 +702,7 @@ def test_filter_string_starts_with(self):
filtered_data = filter.Values(conditions=[
filter.FilterString(-1, filter.FilterString.StartsWith, 'D')
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and row[0].startswith('D')]

Expand All @@ -715,7 +715,7 @@ def test_filter_string_starts_with_case_insensitive(self):
filter.FilterString(-1, filter.FilterString.StartsWith, 'D',
case_sensitive=False)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None
and row[0].lower().startswith('d')]
Expand All @@ -728,7 +728,7 @@ def test_filter_string_ends_with(self):
filtered_data = filter.Values(conditions=[
filter.FilterString(-1, filter.FilterString.EndsWith, 's')
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None and row[0].endswith('s')]

Expand All @@ -741,7 +741,7 @@ def test_filter_string_ends_with_case_insensitive(self):
filter.FilterString(-1, filter.FilterString.EndsWith, 'S',
case_sensitive=False)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data
if row[0] is not None
and row[0].lower().endswith('s')]
Expand All @@ -754,7 +754,7 @@ def test_filter_string_list(self):
filtered_data = filter.Values(conditions=[
filter.FilterStringList(-1, ['et', 'in'])
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data if row[0] in ['et', 'in']]

self.assertEqual(len(filtered_data), len(correct_data))
Expand All @@ -765,7 +765,7 @@ def test_filter_string_list_case_insensitive_value(self):
filtered_data = filter.Values(conditions=[
filter.FilterStringList(-1, ['Et', 'In'], case_sensitive=False)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data if row[0] in ['et', 'in']]

self.assertEqual(len(filtered_data), len(correct_data))
Expand All @@ -776,7 +776,7 @@ def test_filter_string_list_case_insensitive_data(self):
filtered_data = filter.Values(conditions=[
filter.FilterStringList(-1, ['donec'], case_sensitive=False)
])(self.table)
correct_data = [SqlRowInstance(filtered_data.domain, row)
correct_data = [Instance(filtered_data.domain, row)
for row in self.data if row[0] in ['Donec']]

self.assertEqual(len(filtered_data), len(correct_data))
Expand Down

0 comments on commit b408ba7

Please sign in to comment.