<commit_before>import unittest
from wikidataintegrator import wdi_core


class TestItemCreation(unittest.TestCase):
    def test_new_item_creation(self):
        data = [
            wdi_core.WDString(value='test', prop_nr='P1'),
            wdi_core.WDString(value='test1', prop_nr='P2'),
            wdi_core.WDMath("xxx", prop_nr="P3"),
            wdi_core.WDExternalID("xxx", prop_nr="P4"),
            wdi_core.WDItemID("Q123", prop_nr="P5"),
            wdi_core.WDTime('+%Y-%m-%dT%H:%M:%SZ', "P6"),
            wdi_core.WDUrl("http://www.google.com", "P7"),
            wdi_core.WDMonolingualText("xxx", prop_nr="P8"),
            wdi_core.WDQuantity(5, prop_nr="P9"),
            wdi_core.WDQuantity(5, upper_bound=9, lower_bound=2, prop_nr="P10"),
            wdi_core.WDCommonsMedia("xxx", prop_nr="P11"),
            wdi_core.WDGlobeCoordinate(1.2345, 1.2345, 12, prop_nr="P12"),
            wdi_core.WDGeoShape("xxx", prop_nr="P13"),
            wdi_core.WDProperty("P123", "P14")
        ]
        core_props = set(["P{}".format(x) for x in range(20)])

        for d in data:
            item = wdi_core.WDItemEngine(new_item=True, data=[d], core_props=core_props)
            assert item.get_wd_json_representation()
            item = wdi_core.WDItemEngine(new_item=True, data=[d], core_props=set())
            assert item.get_wd_json_representation()

        item = wdi_core.WDItemEngine(new_item=True, data=data, core_props=core_props)
        assert item.get_wd_json_representation()
        item = wdi_core.WDItemEngine(new_item=True, data=data, core_props=set())
        assert item.get_wd_json_representation()<commit_msg>removed domain and item_name<commit_after>import unittest
from wikidataintegrator import wdi_core


class TestItemCreation(unittest.TestCase):
    def test_new_item_creation(self):
        data = [
            wdi_core.WDString(value='test', prop_nr='P1'),
            wdi_core.WDString(value='test1', prop_nr='P2'),
            wdi_core.WDMath("xxx", prop_nr="P3"),
            wdi_core.WDExternalID("xxx", prop_nr="P4"),
            wdi_core.WDItemID("Q123", prop_nr="P5"),
            wdi_core.WDTime('+%Y-%m-%dT%H:%M:%SZ', "P6"),
            wdi_core.WDUrl("http://www.google.com", "P7"),
            wdi_core.WDMonolingualText("xxx", prop_nr="P8"),
            wdi_core.WDQuantity(5, prop_nr="P9"),
            wdi_core.WDQuantity(5, upper_bound=9, lower_bound=2, prop_nr="P10"),
            wdi_core.WDCommonsMedia("xxx", prop_nr="P11"),
            wdi_core.WDGlobeCoordinate(1.2345, 1.2345, 12, prop_nr="P12"),
            wdi_core.WDGeoShape("xxx", prop_nr="P13"),
            wdi_core.WDProperty("P123", "P14")
        ]
        core_props = set(["P{}".format(x) for x in range(20)])

        for d in data:
            item = wdi_core.WDItemEngine(create_new_item=True, data=[d], core_props=core_props)
            assert item.get_wd_json_representation()
            item = wdi_core.WDItemEngine(create_new_itemm=True, data=[d], core_props=set())
            assert item.get_wd_json_representation()

        item = wdi_core.WDItemEngine(new_item=True, data=data, core_props=core_props)
        assert item.get_wd_json_representation()
        item = wdi_core.WDItemEngine(new_item=True, data=data, core_props=set())
        assert item.get_wd_json_representation()
{'fraction_non_alphanumeric': 0.1444043321299639, 'fraction_numerical': 0.026474127557160047, 'mean_word_length': 3.0948275862068964, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5208927', 'n_tokens_mistral': 1227, 'n_tokens_neox': 1175, 'n_words': 156}