<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

# <NAME>
# Summer 2014
# Univerity of Colorado

import copy
import unittest
import werkzeug

import structs
import test_common


class TypesTestCase(test_common.CogsTestCase):

    def setUp(self):

        # Call Parent
        super(TypesTestCase, self).setUp()

        # Setup Server
        self.srv = structs.Server(db=self.db)

        # Setup Admin
        self.admin = self.srv._create_user(test_common.USER_TESTDICT)
        self.admin_uuid = str(self.admin.uuid).lower()
        self.srv.add_admins([self.admin_uuid])

    def tearDown(self):
        super(TypesTestCase, self).tearDown()

    def subHashDirectHelper(self, hash_create, hash_get, hash_list, input_dict,
                            extra_kwargs={}, extra_objs=None, user=None):

        if extra_objs:
            uuids_in = set(extra_objs)
        else:
            uuids_in = set([])

        # List UUIDs (Empty DB)
        uuids_out = hash_list(user=user)
        self.assertEqual(uuids_in, uuids_out)

        # Generate 10 Objects
        objects = []
        for i in range(10):
            obj = hash_create(input_dict, user=user, **extra_kwargs)
            self.assertSubset(input_dict, obj.get_dict())
            objects.append(obj)
            uuids_in.add(str(obj.uuid))

        # List UUIDs
        uuids_out = hash_list(user=user)
        self.assertEqual(uuids_in, uuids_out)

        # Check Objects
        for obj_in in objects:<commit_msg>Added admin remove<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

# <NAME>
# Summer 2014
# Univerity of Colorado

import copy
import unittest
import werkzeug

import structs
import test_common


class TypesTestCase(test_common.CogsTestCase):

    def setUp(self):

        # Call Parent
        super(TypesTestCase, self).setUp()

        # Setup Server
        self.srv = structs.Server(db=self.db)

        # Setup Admin
        self.admin = self.srv._create_user(test_common.USER_TESTDICT)
        self.admin_uuid = str(self.admin.uuid).lower()
        self.srv.add_admins([self.admin_uuid])

    def tearDown(self):

        # Remove Admins
        self.srv.rem_admins([self.admin_uuid])
        self.admin._delete()

        # Call parent
        super(TypesTestCase, self).tearDown()

    def subHashDirectHelper(self, hash_create, hash_get, hash_list, input_dict,
                            extra_kwargs={}, extra_objs=None, user=None):

        if extra_objs:
            uuids_in = set(extra_objs)
        else:
            uuids_in = set([])

        # List UUIDs (Empty DB)
        uuids_out = hash_list(user=user)
        self.assertEqual(uuids_in, uuids_out)

        # Generate 10 Objects
        objects = []
        for i in range(10):
            obj = hash_create(input_dict, user=user, **extra_kwargs)
            self.assertSubset(input_dict, obj.get_dict())
            objects.append(obj)
            uuids_in.add(str(obj.uuid))

        # List UUIDs
        uuids_out = hash_list(user=user)
        self.assertEqual(uuids_in, uuids_out)

        # Check Objects
        for obj_in in objects:
{'fraction_non_alphanumeric': 0.10322786832853947, 'fraction_numerical': 0.005752636625119847, 'mean_word_length': 2.274058577405858, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1332874', 'n_tokens_mistral': 1045, 'n_tokens_neox': 987, 'n_words': 197}