summaryrefslogtreecommitdiffstats
path: root/tests/test_objects.py
blob: 7b1c6ac8cd522f571bab7d3604dd11dde5b43855 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""
This file contains tests for generic object classes.

It requires the 'nose' python package. To run it, just enter this directory and
do:
    
    $ nosetests

If there are errors it can be helpful to debug with:

    $ nosetests --pdb
"""

from nose.tools import *
from nose.plugins.skip import SkipTest
import unittest
import random
import json

from bbb import *

class TestObjects(unittest.TestCase):

    def test_wikidata_org_item(self):
        with open('tests/example_item_nyc.json', 'r') as f:
            d = json.loads(''.join(f.readlines()))
        wi = WikibaseItem.from_dict(d)
        wi.qid()
        wi.to_dict()

    def test_item(self):
        WikibaseItem()
        item = WikibaseItem({"en": "Some Item", "de": "Deutsch Item"})
        WikibaseItem("Some Label", "Some Description", ['Another Name'], "Q93594")
        item.to_dict()
        item.qid()

    def test_property(self):
        prop = WikibaseProperty()
        prop.to_dict()
        prop.pid()

    def test_statement(self):
        stmt = WikibaseStatement()
        raise SkipTest("Not Implemented Yet")
        stmt.to_dict()