Exemplo 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
Exemplo 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
Exemplo 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')
Exemplo 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)
Exemplo n.º 5
0
 def remote_version(self):
     """Resolve the version of the local dictionary."""
     return spell.version(self.remote_filename)
Exemplo 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)
Exemplo 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)
Exemplo n.º 8
0
 def remote_version(self):
     """Resolve the version of the local dictionary."""
     return spell.version(self.remote_path)
Exemplo 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)
Exemplo 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')
Exemplo 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)