Esempio n. 1
0
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
Esempio n. 2
0
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
Esempio n. 3
0
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')
Esempio n. 4
0
 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)
Esempio n. 5
0
 def remote_version(self):
     """Resolve the version of the local dictionary."""
     return spell.version(self.remote_filename)
Esempio n. 6
0
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)
Esempio n. 7
0
 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)
Esempio n. 8
0
 def remote_version(self):
     """Resolve the version of the local dictionary."""
     return spell.version(self.remote_path)
Esempio n. 9
0
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)
Esempio n. 10
0
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')
Esempio n. 11
0
 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)