<commit_before>import unittest

from numpy import array

import Orange.classification.naive_bayes as nb
from Orange import preprocess
from Orange.data.sql.table import SqlTable
from Orange.data import Domain
from Orange.data.variable import DiscreteVariable
from Orange.tests.sql.base import has_psycopg2


@unittest.skipIf(not has_psycopg2, "Psycopg2 is required for sql tests.")
class NaiveBayesTest(unittest.TestCase):
    def test_NaiveBayes(self):
        table = SqlTable(dict(host='localhost', database='test'), 'iris',
                         type_hints=Domain([], DiscreteVariable("iris",
                                values=['Iris-setosa', 'Iris-virginica',
                                        'Iris-versicolor'])))
        table = preprocess.Discretize(table)
        bayes = nb.NaiveBayesLearner()<commit_msg>Fix test of NaiveBayes on SQL table<commit_after>import unittest

from numpy import array

import Orange.classification.naive_bayes as nb
from Orange import preprocess
from Orange.data.sql.table import SqlTable
from Orange.data import Domain
from Orange.data.variable import DiscreteVariable
from Orange.tests.sql.base import has_psycopg2


@unittest.skipIf(not has_psycopg2, "Psycopg2 is required for sql tests.")
class NaiveBayesTest(unittest.TestCase):
    def test_NaiveBayes(self):
        table = SqlTable(dict(host='localhost', database='test'), 'iris',
                         type_hints=Domain([], DiscreteVariable("iris",
                                values=['Iris-setosa', 'Iris-virginica',
                                        'Iris-versicolor'])))
        table = preprocess.Discretize()(table)
        bayes = nb.NaiveBayesLearner()
{'fraction_non_alphanumeric': 0.093935790725327, 'fraction_numerical': 0.0035671819262782403, 'mean_word_length': 3.035971223021583, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7136644', 'n_tokens_mistral': 493, 'n_tokens_neox': 476, 'n_words': 115}