<commit_before>import unittest
import testutils


class TestCreateCollection(unittest.TestCase):

    def setUp(self):
        self.conn = testutils.get_pg_connection()

    def test_creating_a_new_collection(self):
        cur = self.conn.cursor()

        # create a collection 'testone'
        cur.execute("select bq_create_collection('testone')")
        result = cur.fetchone()

        self.assertEqual(len(result), 1)
        self.assertEqual(result[0], True)

        # create it again
        cur.execute("select bq_create_collection('testone')")
        result = cur.fetchone()

        self.assertEqual(len(result), 1)
        self.assertEqual(result[0], False)
<commit_msg>more tests<commit_after>import unittest
import testutils


class TestCreateCollection(unittest.TestCase):

    def setUp(self):
        self.conn = testutils.get_pg_connection()
        self.cur = self.conn.cursor()
        testutils.clean_database(self.conn)

    def test_creating_a_new_collection(self):
        # create a collection 'testone'
        self.cur.execute("select bq_create_collection('testone')")
        result = self.cur.fetchone()

        self.assertEqual(len(result), 1)
        self.assertEqual(result[0], True)

        # create it again
        self.cur.execute("select bq_create_collection('testone')")
        result = self.cur.fetchone()

        self.assertEqual(len(result), 1)
        self.assertEqual(result[0], False)


class TestListCollections(unittest.TestCase):

    def setUp(self):
        self.conn = testutils.get_pg_connection()
        self.cur = self.conn.cursor()

        testutils.clean_database(self.conn)

    def test_list_collections_empty_instance(self):

        self.cur.execute("select bq_list_collections();")
        result = self.cur.fetchone()

        self.assertIsNone(result)

{'fraction_non_alphanumeric': 0.11239035087719298, 'fraction_numerical': 0.0043859649122807015, 'mean_word_length': 3.0736607142857144, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1181697', 'n_tokens_mistral': 553, 'n_tokens_neox': 529, 'n_words': 92}