File: test_dictionary.py

package info (click to toggle)
freedict-tools 0.7.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,520 kB
  • sloc: python: 2,869; haskell: 1,999; perl: 1,509; yacc: 502; sh: 435; sed: 392; makefile: 141; xml: 10
file content (24 lines) | stat: -rw-r--r-- 751 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""Tests for fd_tool.api.dictionary."""

#pylint: disable=too-many-public-methods,import-error,too-few-public-methods,missing-docstring,unused-variable,multiple-imports
import unittest


from fd_tool.api.dictionary import Dictionary

class TestTictionary(unittest.TestCase):
    def test_unset_mandatory_fields_are_detected(self):
        # test for `date`
        d = Dictionary('lat-deu')
        d['headwords'] = 80
        d['edition'] = '0.1.2'
        self.assertFalse(d.is_complete())

    def test_is_complete_recognizes_all_mandatory_fields(self):
        # test for `date`
        d = Dictionary('lat-deu')
        d['headwords'] = 80
        d['edition'] = '0.1.2'
        d['date'] = '1871-12-13'
        self.assertTrue(d.is_complete())