<commit_before>
import unittest
from fredapi import Fred
from datetime import datetime


class TestFred(unittest.TestCase):

    def setUp(self):
        self.fred = Fred()

    def testGetSeries(self):
        s = self.fred.get_series('SP500', observation_start='9/2/2014', observation_end='9/5/2014')
        self.assertEqual(s.ix['9/2/2014'], 2002.28)
        self.assertEqual(len(s), 4)

        info = self.fred.get_series_info('PAYEMS')
        self.assertEqual(info['title'], 'All Employees: Total nonfarm')

        # invalid series id
        self.assertRaises(ValueError, self.fred.get_series, 'invalid')
        self.assertRaises(ValueError, self.fred.get_series_info, 'invalid')

        # invalid parameter
        try:
            self.fred.get_series('SP500', observation_start='invalid-datetime-str')
            self.assertTrue(False, 'previous line should have thrown a ValueError')
        except ValueError:
            pass

    def testSearch(self):
        personal_income_series = self.fred.search_by_release(175, limit=5, order_by='popularity', sort_order='desc')
        series_ids = ['PCPI08081', 'PCPI22071', 'PCPI42101', 'PCPI06083', 'PCPI06075']
        for series_id in series_ids:
            self.assertTrue(series_id in personal_income_series.index)
            self.assertEqual(personal_income_series.ix[series_id, 'observation_start'], datetime(1969, 1, 1))

    def tearDown(self):
        return<commit_msg>updated unit test<commit_after>
import unittest
from fredapi import Fred
from datetime import datetime


class TestFred(unittest.TestCase):

    def setUp(self):
        self.fred = Fred()

    def testGetSeries(self):
        s = self.fred.get_series('SP500', observation_start='9/2/2014', observation_end='9/5/2014')
        self.assertEqual(s.ix['9/2/2014'], 2002.28)
        self.assertEqual(len(s), 4)

        info = self.fred.get_series_info('PAYEMS')
        self.assertEqual(info['title'], 'All Employees: Total nonfarm')

        # invalid series id
        self.assertRaises(ValueError, self.fred.get_series, 'invalid')
        self.assertRaises(ValueError, self.fred.get_series_info, 'invalid')

        # invalid parameter
        try:
            self.fred.get_series('SP500', observation_start='invalid-datetime-str')
            self.assertTrue(False, 'previous line should have thrown a ValueError')
        except ValueError:
            pass

    def testSearch(self):
        personal_income_series = self.fred.search_by_release(175, limit=3, order_by='popularity', sort_order='desc')
        series_ids = ['PCPI06037', 'PCPI06075', 'PCPI24510']
        for series_id in series_ids:
            self.assertTrue(series_id in personal_income_series.index)
            self.assertEqual(personal_income_series.ix[series_id, 'observation_start'], datetime(1969, 1, 1))

    def tearDown(self):
        return
{'fraction_non_alphanumeric': 0.11576011157601115, 'fraction_numerical': 0.042538354253835425, 'mean_word_length': 3.2129221732745963, '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': '1848805', 'n_tokens_mistral': 951, 'n_tokens_neox': 852, 'n_words': 173}