మాడ్యూల్:OSM/testcases

వికీపీడియా నుండి
Jump to navigation Jump to search
-- Example Unit tests for [[Module:OSM]]. Click talk page to run tests.
local p = require('Module:UnitTests')

function p:test_etym()
    self:preprocess_equals('{{#invoke:OSM|etym|id=Q2360250|display=Map}}', "[http://overpass-turbo.eu/?Q=%5Btimeout%3A20%5D%5Bout%3Ajson%5D%3B%0A%28%0Anode%5B%22name%3Aetymology%3Awikidata%22~%22%28%5E%7C%3B%29%28Q2360250%29%28%3B%7C%24%29%22%5D%3B%0Away%5B%22name%3Aetymology%3Awikidata%22~%22%28%5E%7C%3B%29%28Q2360250%29%28%3B%7C%24%29%22%5D%3B%0Arelation%5B%22name%3Aetymology%3Awikidata%22~%22%28%5E%7C%3B%29%28Q2360250%29%28%3B%7C%24%29%22%5D%3B%0A%3E%3E%3B%0A%29%3B%0Aout%20geom%3B%0A%7B%7Bstyle%3A%0Anode%20%5Bname%3Aetymology%3Awikidata%5D%7B%0A%20%20text%3A%20name%3B%0A%20%20icon-width%3A%2032%3B%7D%0A%7D%7D%0A&R Map]", {nowiki = false})
    self:preprocess_equals('{{#invoke:OSM|etym|id=Q118958|display=Streets named after Leuven|query=[highway]|timeout=50|coord=50.879;4.701;9}}', "[http://overpass-turbo.eu/?Q=%5Btimeout%3A50%5D%5Bout%3Ajson%5D%3B%0A%28%0Anode%5B%22name%3Aetymology%3Awikidata%22~%22%28%5E%7C%3B%29%28Q118958%29%28%3B%7C%24%29%22%5D%5Bhighway%5D%28%7B%7Bbbox%7D%7D%29%3B%20%2F%2F%20remove%20the%20%28%7B%7Bbbox%7D%7D%29if%20you%20want%20the%20query%20to%20be%20executed%20globally%0Away%5B%22name%3Aetymology%3Awikidata%22~%22%28%5E%7C%3B%29%28Q118958%29%28%3B%7C%24%29%22%5D%5Bhighway%5D%28%7B%7Bbbox%7D%7D%29%3B%0Arelation%5B%22name%3Aetymology%3Awikidata%22~%22%28%5E%7C%3B%29%28Q118958%29%28%3B%7C%24%29%22%5D%5Bhighway%5D%28%7B%7Bbbox%7D%7D%29%3B%0A%3E%3E%3B%0A%29%3B%0Aout%20geom%3B%0A%7B%7Bstyle%3A%0Anode%20%5Bname%3Aetymology%3Awikidata%5D%7B%0A%20%20text%3A%20name%3B%0A%20%20icon-width%3A%2032%3B%7D%0A%7D%7D%0A&C=50.879;4.701;9&R Streets named after Leuven]", {nowiki = false})
    self:preprocess_equals('{{#invoke:OSM|etym|id=Q13104397|link=no|display=Show avenue named after Numa Ensch Tesch on Openstreetmap}}', "http://overpass-turbo.eu/?Q=%5Btimeout%3A20%5D%5Bout%3Ajson%5D%3B%0A%28%0Anode%5B%22name%3Aetymology%3Awikidata%22~%22%28%5E%7C%3B%29%28Q13104397%29%28%3B%7C%24%29%22%5D%3B%0Away%5B%22name%3Aetymology%3Awikidata%22~%22%28%5E%7C%3B%29%28Q13104397%29%28%3B%7C%24%29%22%5D%3B%0Arelation%5B%22name%3Aetymology%3Awikidata%22~%22%28%5E%7C%3B%29%28Q13104397%29%28%3B%7C%24%29%22%5D%3B%0A%3E%3E%3B%0A%29%3B%0Aout%20geom%3B%0A%7B%7Bstyle%3A%0Anode%20%5Bname%3Aetymology%3Awikidata%5D%7B%0A%20%20text%3A%20name%3B%0A%20%20icon-width%3A%2032%3B%7D%0A%7D%7D%0A&R", {nowiki = false})
end

function p:test_wd()
	self:preprocess_equals('{{#invoke:OSM|wd|id=Q650206;Q713300|display=Vresse and Florenville}}', "[http://overpass-turbo.eu/?Q=%5Btimeout%3A20%5D%5Bout%3Ajson%5D%3B%0A%28%0Anode%5B%22wikidata%22~%22%28%5E%7C%3B%29%28Q650206%7CQ713300%29%28%3B%7C%24%29%22%5D%3B%0Away%5B%22wikidata%22~%22%28%5E%7C%3B%29%28Q650206%7CQ713300%29%28%3B%7C%24%29%22%5D%3B%0Arelation%5B%22wikidata%22~%22%28%5E%7C%3B%29%28Q650206%7CQ713300%29%28%3B%7C%24%29%22%5D%3B%0A%3E%3E%3B%0A%29%3B%0Aout%20geom%3B%0A%7B%7Bstyle%3A%0Anode%20%5Bwikidata%5D%7B%0A%20%20text%3A%20name%3B%0A%20%20icon-width%3A%2032%3B%7D%0A%7D%7D%0A&R Vresse and Florenville]", {nowiki = false})
	self:preprocess_equals('{{#invoke:OSM|wd|id=Q20748715|display=Church of Vresse|coord=49.71513;5.23446;14}}', "[http://overpass-turbo.eu/?Q=%5Btimeout%3A20%5D%5Bout%3Ajson%5D%3B%0A%28%0Anode%5B%22wikidata%22~%22%28%5E%7C%3B%29%28Q20748715%29%28%3B%7C%24%29%22%5D%28%7B%7Bbbox%7D%7D%29%3B%20%2F%2F%20remove%20the%20%28%7B%7Bbbox%7D%7D%29if%20you%20want%20the%20query%20to%20be%20executed%20globally%0Away%5B%22wikidata%22~%22%28%5E%7C%3B%29%28Q20748715%29%28%3B%7C%24%29%22%5D%28%7B%7Bbbox%7D%7D%29%3B%0Arelation%5B%22wikidata%22~%22%28%5E%7C%3B%29%28Q20748715%29%28%3B%7C%24%29%22%5D%28%7B%7Bbbox%7D%7D%29%3B%0A%3E%3E%3B%0A%29%3B%0Aout%20geom%3B%0A%7B%7Bstyle%3A%0Anode%20%5Bwikidata%5D%7B%0A%20%20text%3A%20name%3B%0A%20%20icon-width%3A%2032%3B%7D%0A%7D%7D%0A&C=49.71513;5.23446;14&R Church of Vresse]", {nowiki = false})
	self:preprocess_equals('{{#invoke:OSM|wd|id=Q1716059|prim=w|display=Cemetery of Arlon on a map}}', "[http://overpass-turbo.eu/?Q=%5Btimeout%3A20%5D%5Bout%3Ajson%5D%3B%0A%28%0Away%5B%22wikidata%22~%22%28%5E%7C%3B%29%28Q1716059%29%28%3B%7C%24%29%22%5D%3B%0A%29%3B%0Aout%20geom%3B%0A%7B%7Bstyle%3A%0Anode%20%5Bwikidata%5D%7B%0A%20%20text%3A%20name%3B%0A%20%20icon-width%3A%2032%3B%7D%0A%7D%7D%0A&R Cemetery of Arlon on a map]", {nowiki = false})
end
function p:test_subject()
	self:preprocess_equals('{{#invoke:OSM|subject|id=Q336977|display=Tombstone of Guido Gezelle|coord=51.1936;3.23812;18}}', "[http://overpass-turbo.eu/?Q=%5Btimeout%3A20%5D%5Bout%3Ajson%5D%3B%0A%28%0Anode%5B%22subject%3Awikidata%22~%22%28%5E%7C%3B%29%28Q1356304%29%28%3B%7C%24%29%22%5D%28%7B%7Bbbox%7D%7D%29%3B%20%2F%2F%20remove%20the%20%28%7B%7Bbbox%7D%7D%29if%20you%20want%20the%20query%20to%20be%20executed%20globally%0Away%5B%22subject%3Awikidata%22~%22%28%5E%7C%3B%29%28Q1356304%29%28%3B%7C%24%29%22%5D%28%7B%7Bbbox%7D%7D%29%3B%0Arelation%5B%22subject%3Awikidata%22~%22%28%5E%7C%3B%29%28Q1356304%29%28%3B%7C%24%29%22%5D%28%7B%7Bbbox%7D%7D%29%3B%0A%3E%3E%3B%0A%29%3B%0Aout%20geom%3B%0A%7B%7Bstyle%3A%0Anode%20%5Bsubject%3Awikidata%5D%7B%0A%20%20text%3A%20name%3B%0A%20%20icon-width%3A%2032%3B%7D%0A%7D%7D%0A&C=51.1936;3.23812;18&R Tombstone of Guido Gezelle]", {nowiki = false})
end
function p:test_subject()
	self:preprocess_equals('{{#invoke:OSM|subject|id=Q1356304|display=Statues of Ernest Claes|coord=51.1936;3.23812;18}}', "[http://overpass-turbo.eu/?Q=%5Btimeout%3A20%5D%5Bout%3Ajson%5D%3B%0A%28%0Anode%5B%22subject%3Awikidata%22~%22%28%5E%7C%3B%29%28Q1356304%29%28%3B%7C%24%29%22%5D%28%7B%7Bbbox%7D%7D%29%3B%20%2F%2F%20remove%20the%20%28%7B%7Bbbox%7D%7D%29if%20you%20want%20the%20query%20to%20be%20executed%20globally%0Away%5B%22subject%3Awikidata%22~%22%28%5E%7C%3B%29%28Q1356304%29%28%3B%7C%24%29%22%5D%28%7B%7Bbbox%7D%7D%29%3B%0Arelation%5B%22subject%3Awikidata%22~%22%28%5E%7C%3B%29%28Q1356304%29%28%3B%7C%24%29%22%5D%28%7B%7Bbbox%7D%7D%29%3B%0A%3E%3E%3B%0A%29%3B%0Aout%20geom%3B%0A%7B%7Bstyle%3A%0Anode%20%5Bsubject%3Awikidata%5D%7B%0A%20%20text%3A%20name%3B%0A%20%20icon-width%3A%2032%3B%7D%0A%7D%7D%0A&C=51.1936;3.23812;18&R Statues of Ernest Claes]", {nowiki = false})
end
function p:test_brand()
	self:preprocess_equals("{{#invoke:OSM|brand|id=Q3195848|display=Toon vestigingen op een kaart|style=node{  text: name;  icon-image: url('https://upload.wikimedia.org/wikipedia/commons/0/07/Kewlox_logo.png');  icon-width: 32;} }}", "[http://overpass-turbo.eu/?Q=%5Btimeout%3A20%5D%5Bout%3Ajson%5D%3B%0A%28%0Anode%5B%22brand%3Awikidata%22~%22%28%5E%7C%3B%29%28Q3195848%29%28%3B%7C%24%29%22%5D%3B%0Away%5B%22brand%3Awikidata%22~%22%28%5E%7C%3B%29%28Q3195848%29%28%3B%7C%24%29%22%5D%3B%0Arelation%5B%22brand%3Awikidata%22~%22%28%5E%7C%3B%29%28Q3195848%29%28%3B%7C%24%29%22%5D%3B%0A%3E%3E%3B%0A%29%3B%0Aout%20geom%3B%0A%7B%7Bstyle%3A%0Anode%7B%20%20text%3A%20name%3B%20%20icon-image%3A%20url%28%27https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2F0%2F07%2FKewlox_logo.png%27%29%3B%20%20icon-width%3A%2032%3B%7D%0A%7D%7D%0A&R Toon vestigingen op een kaart]", {nowiki = false})
	self:preprocess_equals("{{#invoke:OSM|brand|id=Q3195848|display=Show locations on map}}", "[http://overpass-turbo.eu/?Q=%5Btimeout%3A20%5D%5Bout%3Ajson%5D%3B%0A%28%0Anode%5B%22brand%3Awikidata%22~%22%28%5E%7C%3B%29%28Q3195848%29%28%3B%7C%24%29%22%5D%3B%0Away%5B%22brand%3Awikidata%22~%22%28%5E%7C%3B%29%28Q3195848%29%28%3B%7C%24%29%22%5D%3B%0Arelation%5B%22brand%3Awikidata%22~%22%28%5E%7C%3B%29%28Q3195848%29%28%3B%7C%24%29%22%5D%3B%0A%3E%3E%3B%0A%29%3B%0Aout%20geom%3B%0A%7B%7Bstyle%3A%0Anode%20%5Bbrand%3Awikidata%5D%7B%0A%20%20text%3A%20name%3B%0A%20%20icon-image%3A%20url%28%22https%3A%2F%2Fcommons.wikimedia.org%2Fwiki%2FSpecial%3ARedirect%2Ffile%2FKewlox%20logo.png%22%29%3B%0A%20%20icon-width%3A%2032%3B%7D%0A%7D%7D%0A&R Show locations on map]", {nowiki = false})
end
function p:test_pt()
	self:preprocess_equals('{{#invoke:OSM|pt|id=Q18012220|display=De Lijn 352 on map}}', "[http://overpass-turbo.eu/?Q=%5Btimeout%3A50%5D%5Bout%3Ajson%5D%3B%0A%28%0Arelation%5B%22wikidata%22~%22%28%5E%7C%3B%29%28Q18012220%29%28%3B%7C%24%29%22%5D%3B%0A%3E%3E%3B%0A%29%3B%0Aout%20geom%3B%0A%7B%7Bstyle%3A%0Anode%20%7B%0A%20%20opacity%3A%200%3B%0A%20%20fill-opacity%3A%200%3B%7D%0Anode%5Bhighway%3Dbus_stop%5D%2C%20way%5Bhighway%3Dbus_stop%5D%7B%0A%20%20text%3A%20name%3B%0A%20%20icon-image%3A%20url%28%27icons%2Fmaki%2Fbus-18.png%27%29%3B%0A%20%20icon-width%3A%2018%3B%7D%0A%7D%7D%0A&R De Lijn 352 on map]", {nowiki = false})
end


return p