Module:wd/sandbox/testcases/testcaseTable

-- work in progress

-- This is going to contain centralized testcases, which are currently triplicated.

-- dependencies used for generating expected outputs

local wdib = require("Module:WikidataIB")

local wd = require("Module:Wd") -- temporary, should be converted to wdib

return {

-- structure: tables, which contain test inputs for the module and corresponding correct outputs

-- and, optionally, a boolean indicating if the testcase is to be inclosed in

    and

{"label|raw|page=Crosslauf-Europameisterschaften 2009|globalSiteId=dewiki", "Q1141358"},

-- These testcases were copied from the old testcase files (Module:wd/testcases/[1, 2, 3]).

-- In the previous version, all testcases with the "format" parameter lacked it when comparing outputs of sandbox against the main module (Module:wd/testcases/3).

{"property|Q55|P395", wdib._getValue{"P395",qid="Q55",noicon="true",osd="no",rank="best",maxvals="1",fwd="ALL"}},

{"property|P395", ""},

{"property|eid=Q55|P395", wdib._getValue{"P395",qid="Q55",noicon="true",osd="no",rank="best",maxvals="1",fwd="ALL"}},

{"property|eid=|P395", ""},

{"property|" .. wd._title{"Q55"} .. "|P395", ""},

{"property|:" .. wd._title{"Q55"} .. "|P395", wdib._getValue{"P395",qid="Q55",noicon="true",osd="no",rank="best",maxvals="1",fwd="ALL"}},

{"property|page=" .. wd._title{"Q55"} .. "|P395", wdib._getValue{"P395",qid="Q55",noicon="true",osd="no",rank="best",maxvals="1",fwd="ALL"}},

{"property|page=:" .. wd._title{"Q55"} .. "|P395", wdib._getValue{"P395",qid="Q55",noicon="true",osd="no",rank="best",maxvals="1",fwd="ALL"}},

{"property|page=|P395", ""},

{"property|edit|Q55|P395", wdib._getValue{"P395",qid="Q55",noicon="true",osd="no",rank="best",maxvals="1",fwd="ALL"} .. " File:OOjs UI icon edit-ltr-progressive.svg"},

{"property|edit@end|Q55|P395", wdib._getValue{"P395",qid="Q55",noicon="true",osd="no",rank="best",maxvals="1",fwd="ALL"} .. "File:OOjs UI icon edit-ltr-progressive.svg"},

{"property|eid=Q55|Q2|P31", wdib._getValue{"P31",qid="Q2",linked="false",noicon="true",osd="no",rank="best",maxvals="1",fwd="ALL"}},

{"property|page=" .. wd._title{"Q55"} .. "|Q2|P31", wdib._getValue{"P31",qid="Q2",linked="false",noicon="true",osd="no",rank="best",maxvals="1",fwd="ALL"}},

{"property|page=" .. wd._title{"Q55"} .. "|eid=Q2|P31", wdib._getValue{"P31",qid="Q2",linked="false",noicon="true",osd="no",rank="best",maxvals="1",fwd="ALL"}},

{'property|P625|P31', ''},

{'property|Property:P625|P31', wdib._getValue{'P31',qid='P625',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}},

{'property|eid=P625|P31', wdib._getValue{'P31',qid='P625',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}},

{'property|eid=Property:P625|P31', wdib._getValue{'P31',qid='P625',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}},

{'property|coord|P31', ''},

{'property|Property:coord|P31', wdib._getValue{'P31',qid='P625',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}},

{'property|eid=coord|P31', wdib._getValue{'P31',qid='P625',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}},

{'property|eid=Property:coord|P31', wdib._getValue{'P31',qid='P625',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}},

{'property|invalid|P31', ''},

{'property|Property:invalid|P31', ''},

{'property|eid=invalid|P31', ''},

{'property|eid=Property:invalid|P31', ''},

{'property|normal+|Q55|P1082', wdib._getValue{'P1082',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}},

{'properties|normal+|Q55|P1082', table.concat({wdib._getValue{'P1082',qid='Q55',noicon='true',osd='no',rank='p',fwd='ALL'}, wdib._getValue{'P1082',qid='Q55',noicon='true',osd='no',rank='n',fwd='ALL'}}, ', ')},

{'properties|qualifier|normal+|Q55|P1082|P585|format=%p[ (%q)][%s][%r]', table.concat({wdib._getValue{'P1082',qid='Q55',qual='P585',noicon='true',osd='no',df='dmy',rank='p',fwd='ALL'}, wdib._getValue{'P1082',qid='Q55',qual='P585',noicon='true',osd='no',df='dmy',rank='n',fwd='ALL'}}, ', ')},

{'property|Q55|P1082', wdib._getValue{'P1082',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}},

{'property|Q55|P1082|punc=.', wdib._getValue{'P1082',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}..'.'},

-- this testcase was originally present only in Module:wd/testcases/3

{'properties|qualifier|normal+|Q55|P1082|P585|format=

  • %p[%r][
    • %q
    ]
  • ', '', true},

    }