Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

Jump to content

Module:PopulationFromWikidata/testcases

From Wikipedia, the free encyclopedia
--Test cases for the sandbox version of the PopulationFromWikidata module. This is a Lua module for testing the sandbox module.

-- we inherit p from another module
-- UnitTests is a system of testing modules. We'll expose the outputs of tests. 
-- We want to specify the expected output to compare to the actual. But for now we're not using this comparison, we're just checking the output manually.
local p = require("module:UnitTests")
function p:test1()
	self:preprocess_equals('{{#invoke:PopulationFromWikidata/sandbox|ListForInfobox}}', '')
--	self:preprocess_equals('{{#invoke:PopulationFromWikidata/sandbox|ListForInfobox|wikidata=Q2821571}}', '', {nowiki=1})
--	self:preprocess_equals('{{#invoke:PopulationFromWikidata/sandbox|ListForInfobox|wikidata=Q2821571}}', '<div>\n* 2,051 (Suburbs and Localities 2021)<ref></ref></div>[[Category:Australian place articles using Wikidata population values]]')
	self:preprocess_equals('{{#invoke:PopulationFromWikidata/sandbox|ListForInfobox|wikidata=Q2821571}}', '', {noexpectation=1})
	self:preprocess_equals('{{#invoke:PopulationFromWikidata/sandbox|ListForInfobox|wikidata=Q2821571|type = suburb}}', '', {noexpectation=1})
	self:preprocess_equals('{{#invoke:PopulationFromWikidata/sandbox|ListForInfobox|wikidata=Q2821571|type = Suburb}}', '', {noexpectation=1})
	self:preprocess_equals('{{#invoke:PopulationFromWikidata/sandbox|ListForInfobox|wikidata=Q2821571|type = town}}', '', {noexpectation=1})
	self:preprocess_equals('{{#invoke:PopulationFromWikidata/sandbox|ListForInfobox|wikidata=Q649969|type = region}}', '', {noexpectation=1})
	self:preprocess_equals('{{#invoke:PopulationFromWikidata/sandbox|ListForInfobox|wikidata=Q11568|type = city}}', '', {noexpectation=1})
	self:preprocess_equals('{{#invoke:PopulationFromWikidata/sandbox|ListForInfobox|wikidata=Q5174266|type = town}}', '', {noexpectation=1})
	
end


return p