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