มอดูล:Wd/testcases/2

--  Unit tests for Module:Wd. Click talk page to run tests.
local p = require('Module:UnitTests')
local wdib = require('Module:WikidataIB')
local wdsb = require('Module:Wd/sandbox')
function p:test_sandbox()
	self:preprocess_equals('P395', wdib._getValue{'P395',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'})
	self:preprocess_equals('P395', )
	self:preprocess_equals('P395', wdib._getValue{'P395',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'})
	self:preprocess_equals('P395', )
	self:preprocess_equals(, )
	self:preprocess_equals(, wdib._getValue{'P395',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'})
	self:preprocess_equals(, wdib._getValue{'P395',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'})
	self:preprocess_equals(, wdib._getValue{'P395',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'})
	self:preprocess_equals('P395', )
	self:preprocess_equals('P395', wdib._getValue{'P395',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'} .. ' Edit this on Wikidata')
	self:preprocess_equals('P395', wdib._getValue{'P395',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'} .. 'Edit this on Wikidata')
	self:preprocess_equals('P31', wdib._getValue{'P31',qid='Q2',linked='false',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'})
	self:preprocess_equals(, wdib._getValue{'P31',qid='Q2',linked='false',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'})
	self:preprocess_equals(, wdib._getValue{'P31',qid='Q2',linked='false',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'})
	self:preprocess_equals('P31', )
	self:preprocess_equals('P31', wdib._getValue{'P31',qid='P625',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'})
	self:preprocess_equals('P31', wdib._getValue{'P31',qid='P625',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'})
	self:preprocess_equals('P31', wdib._getValue{'P31',qid='P625',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'})
	self:preprocess_equals('P31', )
	self:preprocess_equals('P31', wdib._getValue{'P31',qid='P625',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'})
	self:preprocess_equals('P31', wdib._getValue{'P31',qid='P625',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'})
	self:preprocess_equals('P31', wdib._getValue{'P31',qid='P625',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'})
	self:preprocess_equals('P31', )
	self:preprocess_equals('P31', )
	self:preprocess_equals('P31', )
	self:preprocess_equals('P31', )
	self:preprocess_equals('P1082', wdib._getValue{'P1082',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'})
	self:preprocess_equals('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'}}, ', '))
	self:preprocess_equals('#invoke:wd/sandbox|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'}}, ', '))
	self:preprocess_equals('P1082', wdib._getValue{'P1082',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'})
	self:preprocess_equals('punc=.', wdib._getValue{'P1082',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}..'.')
	self:preprocess_equals('P585', table.concat({wdib._getValue{'P1082',qid='Q55',qual='P585',qo='true',sep='; ',noicon='true',osd='no',df='dmy',rank='p',fwd='ALL'}, wdib._getValue{'P1082',qid='Q55',qual='P585',qo='true',sep='; ',noicon='true',osd='no',df='dmy',rank='n',fwd='ALL'}}, '; '))
	self:preprocess_equals('P585', wdib._getValue{'P1082',qid='Q55',qual='P585',qo='true',noicon='true',osd='no',df='dmy',rank='best',maxvals='1',fwd='ALL'})
	self:preprocess_equals('P585', wdib._getValue{'P1082',qid='Q55',qual='P585',qo='true',noicon='true',osd='no',df='mdy',rank='best',maxvals='1',fwd='ALL'})
	self:preprocess_equals('punc=,', ({mw.ustring.gsub(table.concat({wdib._getValue{'P1081',qid='Q55',noicon='true',osd='no',rank='p',fwd='ALL'}, wdib._getValue{'P1081',qid='Q55',noicon='true',osd='no',rank='n',fwd='ALL'}}, ', ')..',', '(.%d%d),', '%10,')})1)
	self:preprocess_equals('punc=,', ({mw.ustring.gsub(table.concat({wdib._getValue{'P1081',qid='Q55',noicon='true',rank='p',fwd='ALL'}, wdib._getValue{'P1081',qid='Q55',noicon='true',rank='n',fwd='ALL'}}, ', ')..',', '(.%d%d),', '%10,')})1)
	self:preprocess_equals('P518', ({string.gsub(wdib._getValue{'P2855',qid='Q55',qual='P518',qo='true',linked='false',noicon='true',osd='no',fwd='ALL'}, '^(^,+).*$', '%1', 1)})1)
	self:preprocess_equals('P518', wdib._getValue{'P2855',qid='Q55',qual='P518',qo='true',linked='false',noicon='true',osd='no',fwd='ALL'})
	self:preprocess_equals('#invoke:wd/sandbox|properties|qualifiers|Q55|P2855|P518|format=%p (%q)%s%r', ({string.gsub(wdib._getValue{'P2855',qid='Q55',qual='P518',linked='false',noicon='true',osd='no',fwd='ALL'}, ' percent', '%%')})1)
	self:preprocess_equals('#invoke:wd/sandbox|properties|qualifiers|Q55|P2855|P518|sep=_+_|sep%s=|sep%q=_/_|format=%p (%q)%s%r', ({string.gsub(wdib._getValue{'P2855',qid='Q55',qual='P518',sep='" + "',qsep='" / "',linked='false',noicon='true',osd='no',fwd='ALL'}, ' percent', '%%')})1)
	self:preprocess_equals('#invoke:wd/sandbox|properties|qualifier|qualifier|normal+|Q55|P35|P580|P582|format=%p (%q)%s%r', table.concat({({string.gsub(wdib._getValue{'P35',qid='Q55',qual='P580',qsep='"; "',linked='false',noicon='true',osd='no',df='dmy',rank='p',fwd='ALL'}, ' – ', , 1)})1, ({string.gsub(wdib._getValue{'P35',qid='Q55',qual='P580,P582',qsep='"; "',linked='false',noicon='true',osd='no',df='dmy',rank='n',fwd='ALL'}, ' – ', '; ')})1}, ', '))
	self:preprocess_equals('#invoke:wd/sandbox|properties|qualifier|qualifier|normal+|Q55|P35|P580|P582|sep%q=_–_|format=%p (%q)%s%r', table.concat({({string.gsub(wdib._getValue{'P35',qid='Q55',qual='P580',qsep='" – "',linked='false',noicon='true',osd='no',df='dmy',rank='p',fwd='ALL'}, ' – ', , 1)})1, ({string.gsub(wdib._getValue{'P35',qid='Q55',qual='P580,P582',qsep='" – "',linked='false',noicon='true',osd='no',df='dmy',rank='n',fwd='ALL'}, ' – ', ' – ')})1}, ', '))
	self:preprocess_equals('#invoke:wd/sandbox|properties|qualifier|qualifier|normal+|Q55|P35|P580|P582|format=%p (%q1 – %q2)%s%r', table.concat({({string.gsub(wdib._getValue{'P35',qid='Q55',qual='P580',qsep='" – "',linked='false',noicon='true',osd='no',df='dmy',rank='p',fwd='ALL'}, ' – ', , 1)})1, ({string.gsub(wdib._getValue{'P35',qid='Q55',qual='P580,P582',qsep='" – "',linked='false',noicon='true',osd='no',df='dmy',rank='n',fwd='ALL'}, ' – ', ' – ')})1}, ', '))
	self:preprocess_equals('#invoke:wd/sandbox|properties|qualifier|raw|qualifier|normal+|Q55|P35|Q29574|P580|P582|format=%p (%q1 – %q2)%s%r', 'Beatrix of the Netherlands (1980-04-30 – 30 April 2013)')
	self:preprocess_equals('#invoke:wd/sandbox|properties|qualifiers|normal+|current|Q55|P38|P518|format=%p (%q)%s%r', ({string.gsub(({string.gsub(table.concat({wdib._getValue{'P38',qid='Q55',qual='P518',linked='false',noicon='true',osd='no',rank='p',fwd='ALL'}, wdib._getValue{'P38',qid='Q55',qual='P518',linked='false',noicon='true',osd='no',rank='n',fwd='ALL'}}, ', '), 'Dutch guilder^,*', , 1)})1, ', ,', ',', 1)})1)
	self:preprocess_equals('#invoke:wd/sandbox|properties|linked|normal+|Q55|P38|format=%p (%q)%s%r', ({string.gsub(table.concat({wdib._getValue{'P38',qid='Q55',noicon='true',osd='no',rank='p',fwd='ALL'}, wdib._getValue{'P38',qid='Q55',noicon='true',osd='no',rank='n',fwd='ALL'}}, ', '), '(+)|%1', '%1')})1)
	self:preprocess_equals('#invoke:wd/sandbox|properties|linked|short|normal+|Q55|P38|format=%p (%q)%s%r', ({string.gsub(table.concat({wdib._getValue{'P38',qid='Q55',sn='true',noicon='true',osd='no',rank='p',fwd='ALL'}, wdib._getValue{'P38',qid='Q55',sn='true',noicon='true',osd='no',rank='n',fwd='ALL'}}, ', '), '(+)|%1', '%1')})1)
	self:preprocess_equals('P518', wdib.getQualifierValue{args={'P38',qid='Q55',qual='P518',pval='Q4917',linked='false',noicon='true',osd='no',fwd='ALL'}})
	self:preprocess_equals('P518=Q27561', wdib.getValueByQual{args={'P38',qid='Q55',qualID='P518',qvalue='Q27561',linked='false',noicon='true',osd='no',fwd='ALL'}})
	self:preprocess_equals('P38', 'Dutch guilder')
	self:preprocess_equals('P38', 'Q788472')
	self:preprocess_equals('P38', 'Q788472')
	self:preprocess_equals('P1549', wdib._getValue{'P1549',qid='Q55',noicon='true',osd='no',rank='best',fwd='ALL'})
	self:preprocess_equals('P407=Q36846', wdib.getValueByQual{args={'P1549',qid='Q55',qualID='P407',qvalue='Q36846',noicon='true',osd='no',fwd='ALL'}})
	self:preprocess_equals('P2884', wdib._getValue{'P2884',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'})
	self:preprocess_equals('P2884', wdib._getValue{'P2884',qid='Q55',su='false',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'})
	self:preprocess_equals('P2884', ({string.gsub(wdib._getValue{'P2884',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}, '^^ + (.+)$', '%1', 1)})1)
	self:preprocess_equals('P2884',  .. ({string.gsub(({string.gsub(wdib._getValue{'P2884',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}, '^^ + (.+)$', '%1|%1', 1)})1, '^.', string.upper, 1)})1 .. )
	self:preprocess_equals('P2884', 'Q25250')
	self:preprocess_equals('P625', ({string.gsub(({string.gsub(({string.gsub(wdib._getValue{'P625',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}, "′", "'", 2)})1, '″', '"', 2)})1, ' ', ', ', 1)})1)
	self:preprocess_equals('P625', ' ..  ({mw.ustring.gsub(wdib._getValue{'P625',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}, '°′″ ', '_')})1 .. '_globe:earth ' .. ({string.gsub(({string.gsub(({string.gsub(wdib._getValue{'P625',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}, "′", "'", 2)})1, '″', '"', 2)})1, ' ', ', ', 1)})1 .. )
	self:preprocess_equals('P625', ({mw.ustring.gsub(wdib._getValue{'P625',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}, '°′″ ', '/')})1)
	self:preprocess_equals('coord', ({string.gsub(({string.gsub(({string.gsub(wdib._getValue{'P625',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}, "′", "'", 2)})1, '″', '"', 2)})1, ' ', ', ', 1)})1)
	self:preprocess_equals('P41',  .. wdib._getValue{'P41',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'} .. )
	self:preprocess_equals('P41', wdib._getValue{'P41',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'})
	self:preprocess_equals('P41', 'Statenvlag.svg')
	self:preprocess_equals('P41', 'Prinsenvlag.svg')
	self:preprocess_equals('P2534', '\\frac{n^2 - 1}{n^2 + 2} = \\frac{4 \\pi}{3} N \\alpha')
	self:preprocess_equals('P3896',  .. mw.getCurrentFrame():callParserFunction{name='#property:P3896',args={from='Q6256'}} .. )
	self:preprocess_equals('Q4917', wdib.getLabel{args={'Q4917'}})
	self:preprocess_equals('Q4917', ({string.gsub(wdib.getLink{args={'Q4917'}}, ':(+)|%1', '%1', 1)})1)
	self:preprocess_equals('P38', wdib.getLabel{args={'P38'}})
	self:preprocess_equals('P38',  .. wdib.getLabel{args={'P38'}} .. )
	self:preprocess_equals('Q776', wdib.getLabel{args={'Q776'}})
	self:preprocess_equals('Q776', ({string.gsub(wdib.getLink{args={'Q776'}}, '%%:', , 1)})1)
	self:preprocess_equals('eid=Q776', wdib.getLabel{args={'Q776'}})
	self:preprocess_equals(, wdib.getLabel{args={'Q776'}})
	self:preprocess_equals(, wdib.getLabel{args={'Q776'}})
	self:preprocess_equals(, wdib.getLabel{args={'Q776'}})
	self:preprocess_equals('Q2', wdib.getLabel{args={'Q2'}})
	self:preprocess_equals(, wdib.getLabel{args={'Q2'}})
	self:preprocess_equals(, wdib.getLabel{args={'Q2'}})
	self:preprocess_equals('label', )
	self:preprocess_equals('eid=', )
	self:preprocess_equals('raw', )
	self:preprocess_equals('Q776', 'Q776')
	self:preprocess_equals('Q776', 'Q776')
	self:preprocess_equals('P625', wdib.getLabel{args={'P625'}})
	self:preprocess_equals('Property:P625', wdib.getLabel{args={'P625'}})
	self:preprocess_equals('eid=P625', wdib.getLabel{args={'P625'}})
	self:preprocess_equals('eid=Property:P625', wdib.getLabel{args={'P625'}})
	self:preprocess_equals('coord', wdib.getLabel{args={'P625'}})
	self:preprocess_equals('Property:coord', wdib.getLabel{args={'P625'}})
	self:preprocess_equals('eid=coord', wdib.getLabel{args={'P625'}})
	self:preprocess_equals('eid=Property:coord', wdib.getLabel{args={'P625'}})
	self:preprocess_equals('invalid', )
	self:preprocess_equals('Property:invalid', )
	self:preprocess_equals('eid=invalid', )
	self:preprocess_equals('eid=Property:invalid', )
	self:preprocess_equals('Q6', )
	self:preprocess_equals('Q10000000000', )
	self:preprocess_equals('P3', )
	self:preprocess_equals('P10000000000', )
	self:preprocess_equals('Q776', wdib.getSiteLink{args={qid='Q776'}})
	self:preprocess_equals('Q776',  .. wdib.getSiteLink{args={qid='Q776'}} .. )
	self:preprocess_equals('title', )
	self:preprocess_equals('Q55', wdib.getDescription{args={qid='Q55','wikidata'}})
	self:preprocess_equals('description', )
	self:preprocess_equals('Q6', )
	self:preprocess_equals('Q10000000000', )
	self:preprocess_equals('P3', )
	self:preprocess_equals('P10000000000', )
	self:preprocess_equals('Q55', ({string.gsub(wdib.getAliases{args={qid='Q55',noicon='true',fwd='ALL'}}, '^(^,+).*$', '%1', 1)})1)
	self:preprocess_equals('Q55', wdib.getAliases{args={qid='Q55',noicon='true',fwd='ALL'}})
	self:preprocess_equals('Q55',  .. wdib.getSiteLink{args={qid='Q55'}} .. '|' .. ({string.gsub(wdib.getAliases{args={qid='Q55',noicon='true',fwd='ALL'}}, '^(^,+).*$', '%1', 1)})1 .. )
	self:preprocess_equals('alias', )
	self:preprocess_equals('Q2', 'featured article badge')
	self:preprocess_equals('Q2', 'Q17437796')
	self:preprocess_equals('badges', )
end
return p