Page MenuHomePhabricator

test_get_most_common_info: AttributeError: 'module' object has no attribute 'Counter'
Closed, ResolvedPublic

Description

https://travis-ci.org/wikimedia/pywikibot-core/jobs/211642096#L4143

self = <tests.djvu_tests.TestDjVuFile testMethod=test_get_most_common_info>

    def test_get_most_common_info(self):

        """Test page number generator."""

        djvu = DjVuFile(self.file_djvu)

>       self.assertEqual(djvu.get_most_common_info(), ('1092x221', 600))

tests/djvu_tests.py:64: 

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pywikibot.tools.djvu.DjVuFile object at 0x9f90f10>

    def get_most_common_info(self):

        """Return most common size and dpi for pages in djvu file."""

>       cnt = collections.Counter(s_d for _, s_d in self._get_page_info().values())

E       AttributeError: 'module' object has no attribute 'Counter'

Counter class is new in Python 2.7, 2.6 does not have it.