Jump to content

Module:PopulationFromWikidata/testcases: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
No edit summary
Line 3: Line 3:
-- we inherit p from another module
-- we inherit p from another module
-- UnitTests is a system of testing modules. We'll expose the outputs of tests.
-- 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")
local p = require("module:UnitTests")
function p:test1()
function p:test1()
self:preprocess_equals('{{#invoke:PopulationFromWikidata|ListForInfobox}}', '')
self:preprocess_equals('{{#invoke:PopulationFromWikidata/sandbox|ListForInfobox}}', '')
self:preprocess_equals('{{#invoke:PopulationFromWikidata|ListForInfobox|wikidata=Q2821571}}', '')
-- 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}}', '')

end
end



Revision as of 04:18, 11 July 2022

--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}}', '')

end


return p