<commit_before><commit_msg>Added dryrun tests from pickle branch<commit_after>#!/usr/bin/env python

import unittest
import graphitesend


class TestDryRun(unittest.TestCase):
    """ Tests to make sure that a dryrun is just that. """

    def setUp(self):
        """ reset graphitesend """
        # Drop any connections or modules that have been setup from other tests
        graphitesend.reset()

    def testEmptyAddr(self):
        g = graphitesend.init(prefix='', dryrun=True)
        self.assertEqual(g.addr, None)

    def testCreateGraphiteClient(self):
        g = graphitesend.init(prefix='', dryrun=True)
        self.assertEqual(type(g).__name__, 'GraphiteClient')
        dryrun_message = g.send('metric', 1, 1)
        self.assertEqual(dryrun_message, "metric 1.000000 1\n")

    def testDryrunConnectFailure(self):
        g = graphitesend.init(prefix='', dryrun=True)
        self.assertEqual(type(g).__name__, 'GraphiteClient')
        with self.assertRaises(graphitesend.GraphiteSendException):
            g.connect()

{'fraction_non_alphanumeric': 0.11346153846153846, 'fraction_numerical': 0.009615384615384616, 'mean_word_length': 3.3556485355648538, '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': '74640', 'n_tokens_mistral': 321, 'n_tokens_neox': 304, 'n_words': 72}