def test_version(message_mock, caplog): """Tests parsing dictionary version from its file name.""" assert spell.version('en-US-8-0.bdic') == (8, 0) assert spell.version('pl-PL-3-0.bdic') == (3, 0) with caplog.at_level(logging.WARNING): assert spell.version('malformed_filename') is None msg = message_mock.getmsg(usertypes.MessageLevel.warning) expected = ("Found a dictionary with a malformed name: malformed_filename") assert msg.text == expected
def test_version(): assert spell.version('en-US-8-0.bdic') == (8, 0) assert spell.version('pl-PL-3-0.bdic') == (3, 0) with pytest.raises(ValueError): spell.version('malformed_filename')
def local_version(self): """Resolve the version of the local dictionary.""" local_filename = self.local_filename if local_filename is None: return None return spell.version(local_filename)
def remote_version(self): """Resolve the version of the local dictionary.""" return spell.version(self.remote_filename)
def latest_yet(code2file, code, filename): """Determine whether the latest version so far.""" if code not in code2file: return True return spell.version(code2file[code]) < spell.version(filename)
def local_version(self): """Resolve the version of the local dictionary.""" local_path = self.local_path if local_path is None: return None return spell.version(local_path)
def remote_version(self): """Resolve the version of the local dictionary.""" return spell.version(self.remote_path)