<commit_before>import mongomock
from six import text_type
import random
import time
import copy

try:
    import pymongo
    from pymongo import ASCENDING, DESCENDING
    _HAVE_PYMONGO = True
except ImportError:
    _HAVE_PYMONGO = False

from .utils import TestCase, skipIf


class CollectionAPITest(TestCase):
    def setUp(self):
        super(CollectionAPITest, self).setUp()
        self.conn = mongomock.Connection()
        self.db = self.conn['somedb']

    def test__get_subcollections(self):
        self.db.a.b
        self.assertEquals(self.db.a.b.full_name, "somedb.a.b")
        self.assertEquals(self.db.a.b.name, "a.b")

        self.assertEquals(
            set(self.db.collection_names()),
            set(["a.b", "system.indexes", "a"]))

    def test__get_collection_full_name(self):
        self.assertEquals(self.db.coll.name, "coll")
        self.assertEquals(self.db.coll.full_name, "somedb.coll")

    def test__get_collection_names(self):
        self.db.a
        self.db.b
        self.assertEquals(set(self.db.collection_names()), set(['a', 'b', 'system.indexes']))
        self.assertEquals(set(self.db.collection_names(True)), set(['a', 'b', 'system.indexes']))
        self.assertEquals(set(self.db.collection_names(False)), set(['a', 'b']))

    def test__cursor_collection(self):
        self.assertIs(self.db.a.find().collection, self.db.a)

    def test__drop_collection(self):
        self.db.a
        self.db.b
        self.db.c
        self.db.drop_collection('b')
        self.db.drop_collection('b')
        self.db.drop_collection(self.db.c)
        self.assertEquals(set(self.db.collection_names()), set(['a', 'system.indexes']))

    def test__distinct_nested_field(self):<commit_msg>added valid drop colleciton test cases<commit_after>import mongomock
from six import text_type
import random
import time
import copy

try:
    import pymongo
    from pymongo import ASCENDING, DESCENDING
    _HAVE_PYMONGO = True
except ImportError:
    _HAVE_PYMONGO = False

from .utils import TestCase, skipIf


class CollectionAPITest(TestCase):
    def setUp(self):
        super(CollectionAPITest, self).setUp()
        self.conn = mongomock.Connection()
        self.db = self.conn['somedb']

    def test__get_subcollections(self):
        self.db.a.b
        self.assertEquals(self.db.a.b.full_name, "somedb.a.b")
        self.assertEquals(self.db.a.b.name, "a.b")

        self.assertEquals(
            set(self.db.collection_names()),
            set(["a.b", "system.indexes", "a"]))

    def test__get_collection_full_name(self):
        self.assertEquals(self.db.coll.name, "coll")
        self.assertEquals(self.db.coll.full_name, "somedb.coll")

    def test__get_collection_names(self):
        self.db.a
        self.db.b
        self.assertEquals(set(self.db.collection_names()), set(['a', 'b', 'system.indexes']))
        self.assertEquals(set(self.db.collection_names(True)), set(['a', 'b', 'system.indexes']))
        self.assertEquals(set(self.db.collection_names(False)), set(['a', 'b']))

    def test__cursor_collection(self):
        self.assertIs(self.db.a.find().collection, self.db.a)

    def test__drop_collection(self):
        self.db.a
        self.db.b
        self.db.c
        self.db.drop_collection('b')
        self.db.drop_collection('b')
        self.db.drop_collection(self.db.c)
        self.assertEquals(set(self.db.collection_names()), set(['a', 'system.indexes']))

        col = self.db.a

        r = col.insert({"aa": "bb"})

        qr = col.find({"_id": r})

        self.assertEqual(qr.count(), 1)

        self.db.drop_collection("a")

        qr = col.find({"_id": r})

        self.assertEqual(qr.count(), 0)

        col = self.db.a

        r = col.insert({"aa": "bb"})

        qr = col.find({"_id": r})

        self.assertEqual(qr.count(), 1)

        self.db.drop_collection(col)

        qr = col.find({"_id": r})

        self.assertEqual(qr.count(), 0)

    def test__distinct_nested_field(self):
{'fraction_non_alphanumeric': 0.14883487847657229, 'fraction_numerical': 0.0010022550739163117, 'mean_word_length': 2.8237547892720305, 'pattern_counts': {'":': 6, '<': 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': '641450', 'n_tokens_mistral': 1370, 'n_tokens_neox': 1311, 'n_words': 218}