def test_no_refereed_citations(self):
     '''Test getting time series when there is no usage and no citations'''
     from metrics import get_time_series
     years = [int(b[:4]) for b in testset]
     # Expected histogram (for all)
     expected = {year: 0 for year in range(min(years), current_year + 1)}
     # Get the reads histograms
     ts = get_time_series(testset, testset)
     indicators = ['h', 'g', 'i10', 'i100', 'read10']
     for indicator in indicators:
         self.assertEqual(ts[indicator], expected)
 def test_no_refereed_citations(self):
     '''Test getting time series when there is no usage and no citations'''
     from metrics import get_time_series
     years = [int(b[:4]) for b in testset]
     # Expected histogram (for all)
     expected = {year: 0 for year in range(min(years), current_year + 1)}
     # Get the reads histograms
     ts = get_time_series(testset, testset)
     indicators = ['h', 'g', 'i10', 'i100', 'read10']
     for indicator in indicators:
         self.assertEqual(ts[indicator], expected)
    def test_time_series(self):
        '''Test getting the time series'''
        from metrics import get_time_series

        ts = get_time_series(testset, testset)
        # The time series get test over the range of publication years
        years = [int(b[:4]) for b in testset]
        yrange = range(min(years), max(years) + 1)
        indicators = ['h', 'g', 'i10', 'i100', 'read10']
        for indicator in indicators:
            serie = {y: ts[indicator][y] for y in yrange}
            expected = {
                int(k): v for k, v in
                expected_results['time series'][indicator].items()}
            self.assertEqual(serie, expected)
        serie = {y: ts['tori'][y] for y in yrange}
        expected = {
            int(k): v for k, v in
            expected_results['time series']['tori'].items()}
        self.assertTrue(
            'False' not in [np.allclose([serie[y]],
                            expected[y]) for y in yrange])
Esempio n. 4
0
    def test_time_series(self):
        '''Test getting the time series'''
        from metrics import get_time_series

        ts = get_time_series(testset, testset)
        # The time series get test over the range of publication years
        years = [int(b[:4]) for b in testset]
        yrange = range(min(years), max(years) + 1)
        indicators = ['h', 'g', 'i10', 'i100', 'read10']
        for indicator in indicators:
            serie = {y: ts[indicator][y] for y in yrange}
            expected = {
                int(k): v
                for k, v in expected_results['time series'][indicator].items()
            }
            self.assertEqual(serie, expected)
        serie = {y: ts['tori'][y] for y in yrange}
        expected = {
            int(k): v
            for k, v in expected_results['time series']['tori'].items()
        }
        self.assertTrue('False' not in
                        [np.allclose([serie[y]], expected[y]) for y in yrange])