<commit_before>'''
Created on Sep 23, 2013

@author: tulvur
'''
import unittest
from random import shuffle
from mock import MagicMock
from actuation.api.rest import RESTProvider
from actuation.impl.rest.lamp.mock.discovery import MockDiscovery
from actuation.impl.rest.lamp.mock.agents import Crawler


# Through these 2 classes, we indirectly test LampConsumerRESTMock

class CrawlerTest(unittest.TestCase):

    def setUp(self):
        self.discovery = MockDiscovery()        
        self.discovery.add_discovered( ProvidersFactory.create_mock_providers(), "fakename" )
        self.crawler= Crawler("", self.discovery)
    
    def test_obtain_resource_descriptions(self):
        self.crawler._obtain_resource_descriptions()
        
        expected = ["desc%d"%i for i in range(1,4)]
        expected.extend( ["desc1%d"%i for i in range(4,6)] )
        expected.extend( ["desc2%d"%i for i in range(4,6)] )<commit_msg>Fixing tests after last refactor<commit_after>'''
Created on Sep 23, 2013

@author: tulvur
'''
import unittest
from random import shuffle
from mock import MagicMock
from actuation.api.rest import RESTProvider
from actuation.impl.rest.mock.discovery import MockDiscovery
from actuation.impl.rest.mock.agents import Crawler


# Through these 2 classes, we indirectly test LampConsumerRESTMock

class CrawlerTest(unittest.TestCase):

    def setUp(self):
        self.discovery = MockDiscovery()        
        self.discovery.add_discovered( ProvidersFactory.create_mock_providers(), "fakename" )
        self.crawler= Crawler( self.discovery )
    
    def test_obtain_resource_descriptions(self):
        self.crawler._obtain_resource_descriptions()
        
        expected = ["desc%d"%i for i in range(1,4)]
        expected.extend( ["desc1%d"%i for i in range(4,6)] )
        expected.extend( ["desc2%d"%i for i in range(4,6)] )
{'fraction_non_alphanumeric': 0.10070005385029618, 'fraction_numerical': 0.01615508885298869, 'mean_word_length': 3.8134715025906734, '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': '1410549', 'n_tokens_mistral': 598, 'n_tokens_neox': 567, 'n_words': 146}