Modulo:Wikidata/test: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
+test getId
m nomi funzioni più brevi
Riga 2:
local p = require("Module:UnitTests")
 
function p:test_wikidata_getPropertytest_getProperty()
self:preprocess_equals_many("{{Wikidata/Sandbox|from=Q503361|", "}}", {
-- property
Riga 84:
end
 
function p:test_wikidata_patterntest_pattern()
self:preprocess_equals_many("{{Wikidata/Sandbox|from=Q503361|", "}}", {
-- pattern
Riga 99:
end
 
function p:test_wikidata_languagetest_language()
self:preprocess_equals_many("{{Wikidata/Sandbox|from=Q30|", "}}", {
{ "P1813|includelang=en", "USA, America e United States" },
Riga 107:
end
 
function p:test_wikidata_timetest_time()
self:preprocess_equals_many("{{Wikidata/Sandbox|", "}}", {
{ "from=Q38|P571", "2 giugno 1946" },
Riga 129:
end
 
function p:test_wikidata_qualifiervaluetest_qualifiervalue()
self:preprocess_equals_many("{{Wikidata/Sandbox|from=Q38|", "}}", {
-- qualifier + qualifiervalue (item)
Riga 136:
end
 
function p:test_wikidata_showqualifierstest_showqualifiers()
self:preprocess_equals_many("{{Wikidata/Sandbox|from=Q38|", "}}", {
{ "P38|showqualifiers=P580|rank=normal", "[[Lira italiana|lira italiana]] (2 giugno 1946)" },
Riga 146:
end
 
function p:test_wikidata_getQualifiertest_getQualifier()
self:preprocess_equals_many("{{WikidataQ/Sandbox|from=Q503361|", "}}", {
-- qualifier non esistente => ""
Riga 169:
end
 
function p:test_wikidata_qualifier_nqtest_qualifier_nq()
self:preprocess_equals_many("{{WikidataQ/Sandbox|from=Q68060|", "}}", {
{ "P856|P407", "[[Lingua italiana|italiano]] e [[Lingua inglese|inglese]]" },
Riga 178:
end
 
function p:test_wikidata_indexOftest_indexOf()
self:preprocess_equals_many("{{WikidataIdx/Sandbox|from=Q503361|", "}}", {
{ "P47|Q186662", "1" },
Riga 190:
end
 
function p:test_wikidata_Ntest_N()
self:preprocess_equals_many("{{WikidataN/Sandbox|from=Q503361|", "}}", {
{ "P1", "0" },
Riga 202:
end
 
function p:test_wikidata_getLabeltest_getLabel()
self:preprocess_equals_many("{{WikidataLabel/Sandbox|", "}}", {
-- property
Riga 213:
end
 
function p:test_wikidata_getLinktest_getLink()
self:preprocess_equals_many("{{WikidataLink/Sandbox|", "}}", {
-- sitelink e label => [[sitelink|label]]
Riga 226:
end
 
function p:test_wikidata_getDatatypetest_getDatatype()
self:preprocess_equals_many("{{WikidataTipo/Sandbox|", "}}", {
{ "P10", "file multimediale su Commons" },
Riga 242:
end
 
function p:test_wikidata_getIdtest_getId()
self:preprocess_equals_many("{{WikidataId/Sandbox|", "}}", {
{ "Italia", "Q38" }
Riga 248:
end
 
function p:test_wikidata_instanceOftest_instanceOf()
self:preprocess_equals_many("{{WikidataIstanza/Sandbox|from=Q503361|", "}}", {
{ "Q127448", "1" },
Riga 255:
end
 
function p:test_wikidata_extlinktest_extlink()
self:preprocess_equals_many("{{Wikidata/Sandbox|from=Q8038|extlink=1|", "}}", {
{ "P856", "<div style=\"word-break: break-all;\">[https://www.gimp.org www.gimp.org]</div>" },
Riga 264:
end
 
function p:test_wikidata_converttest_convert()
self:preprocess_equals_many("{{Wikidata/Sandbox|", "}}", {
-- lunghezza
Riga 293:
end
 
function p:test_wikidata_formatnumtest_formatnum()
self:preprocess_equals_many("{{Wikidata/Sandbox|formatnum=1|", "}}", {
-- dal modulo stesso
Riga 306:
end
 
function p:test_wikidata_roundingtest_rounding()
self:preprocess_equals_many("{{Wikidata/Sandbox|formatnum=1|", "}}", {
-- dal modulo stesso