<commit_before>import os
import unittest
from pymongo import MongoClient
import datetime as dt
import time
import sqlite3
import driveshare_graph.uptime as uptime


class Uptime(unittest.TestCase):

    def test_create_farmers_table(self):
        conn = sqlite3.connect('test.db')
        cursor = conn.cursor()
        uptime.create_farmers_table(conn, cursor)
        dir = os.path.abspath('test.db')
        boolean = os.path.exists(dir)
        self.assertTrue(boolean)
        conn.close()

    def test_init_farmers_table(self):
        conn = sqlite3.connect('init_test.db')
        cursor = conn.cursor()
        client = MongoClient('localhost', 27017)
        collection = client['GroupB']['farmers']
        uptime.create_farmers_table(conn, cursor)
        uptime.init_farmers_table(conn, cursor, collection)
        cursor.execute('SELECT uptime FROM farmers')
        data = cursor.fetchone()[0]
        self.assertTrue(data > 0)
        conn.close()

    def test_address_in_db(self):<commit_msg>uptime test<commit_after>import os
import unittest
from pymongo import MongoClient
import datetime as dt
import time
import sqlite3
import driveshare_graph.uptime as uptime


class Uptime(unittest.TestCase):

    def test_create_farmers_table(self):
        conn = sqlite3.connect('test.db')
        cursor = conn.cursor()
        uptime.create_farmers_table(conn, cursor)
        dir = os.path.abspath('test.db')
        boolean = os.path.exists(dir)
        self.assertTrue(boolean)
        conn.close()

    def test_init_farmers_table(self):
        conn = sqlite3.connect('driveshare_graph.init_test.db')
        cursor = conn.cursor()
        client = MongoClient('localhost', 27017)
        collection = client['GroupB']['farmers']
        uptime.create_farmers_table(conn, cursor)
        uptime.init_farmers_table(conn, cursor, collection)
        cursor.execute('SELECT uptime FROM farmers')
        data = cursor.fetchall()
        self.assertTrue(len(data) > 0)
        conn.close()

    def test_address_in_db(self):
{'fraction_non_alphanumeric': 0.10240078392944635, 'fraction_numerical': 0.009309162175404213, 'mean_word_length': 3.108651911468813, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2718006', 'n_tokens_mistral': 659, 'n_tokens_neox': 623, 'n_words': 126}