Jump to content

Module:Infobox television season disambiguation check/testcases

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Gonnym (talk | contribs) at 17:39, 6 June 2019. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
-- Example Unit tests for [[Module:Infobox television season disambiguation check]]. Click talk page to run tests.
local p = require('Module:UnitTests')
--[[
function p:test_1_main()
	self:preprocess_equals_many('{{#invoke:Infobox television season disambiguation check|main|', '}}', {
		{'', "Debug: Error: Empty title."},
		{'Lost', "Debug: No disambiguation."},
		{'Lost 1', "Debug: No disambiguation.""},
		{'Lost (TV series)', "Debug: Using incorrect infobox - ^%D+ TV series."},
		{'Lost (TV program)', "Debug: Using a valid format."},
		{'Lost (TV programme)', "Debug: Using a valid format."},
		{'Lost (TV film)', "Debug: Using a valid format."},
		{'Lost (film)', "Debug: Using a valid format."},
		{'Lost (miniseries)', "Debug: Using a valid format."},
		{'Lost (serial)', "Debug: Using a valid format."},
		{'Lost (game show)', "Debug: Using a valid format."},
		{'Lost (talk show)', "Debug: Using a valid format."},
		{'Lost (web series)', "Debug: Using a valid format."},
		{'The (206)', "Debug: Title on exception list."},
		{'Cinderella (Apakah Cinta Hanyalah Mimpi?)', "Debug: Title on exception list."},
		{'How to Live with Your Parents (For the Rest of Your Life)', "Debug: Title on exception list."},
		{'I (Almost) Got Away With It', "Debug: Title on exception list."},
		{'Monty Python: Almost the Truth (Lawyers Cut)', "Debug: Title on exception list."},
		{'Randall and Hopkirk (Deceased)', "Debug: Title on exception list."}
	})
end
 --]]

function p:test_1_general_sandbox()
	self:preprocess_equals_many('{{#invoke:Infobox television season disambiguation check/sandbox|test|', '}}', {
		{'', "Debug: Error: Empty title."},
		{'Lost', "Debug: No disambiguation."},
		{'Lost 1', "Debug: No disambiguation."}
	})
end

-- Debug: Not a valid format. - this should be here instead, but current code makes it harder to make the debug process clean.
function p:test_2_invalid_formats_sandbox()
	self:preprocess_equals_many('{{#invoke:Infobox television season disambiguation check/sandbox|test|', '}}', {
		{'Lost (bad disambiguation)', "Debug: Using a valid format but using an incorrect extended style."}, 
		{'Lost (soap opera)', "Debug: Using a valid format but using an incorrect extended style."},
		{'Lost (anime)', "Debug: Using a valid format but using an incorrect extended style."},
		{'Lost (TV series)', "Debug: Using incorrect infobox - ^%D+ TV series."},
		{'Lost (TV program)', "Debug: Using a valid format but using an incorrect extended style."},
		{'Lost (TV programme)', "Debug: Using a valid format but using an incorrect extended style."},
		{'Lost (TV film)', "Debug: Using a valid format but using an incorrect extended style."},
		{'Lost (film)', "Debug: Using a valid format but using an incorrect extended style."},
		{'Lost (miniseries)', "Debug: Using a valid format but using an incorrect extended style."},
		{'Lost (serial)', "Debug: Using a valid format but using an incorrect extended style."},
		{'Lost (game show)', "Debug: Using a valid format but using an incorrect extended style."},
		{'Lost (talk show)', "Debug: Using a valid format but using an incorrect extended style."},
		{'Lost (web series)', "Debug: Using a valid format but using an incorrect extended style."}
	})
end

function p:test_3_extended_disamiguation_sandbox()
	self:preprocess_equals_many('{{#invoke:Infobox television season disambiguation check/sandbox|test|', '}}', {
		{'Lost (season 1)', "Debug: Using a valid format with a Season number - valid."},
		{'Lost (season 01)', "Debug: Using a valid format with a Season number - invalid."},
		{'Doctor Who (series 1)', "Debug: Using a valid format with a Season number - valid."},
		{'Lost (American season 1)', "Debug: Using a valid format with an extended Country and Season number - valid."},
		{'Lost (U.S. season 1)', "Debug: Using a valid format with an extended Country and Season number - invalid."},
		{'Lost (American season 01)', "Debug: Using a valid format with an extended Country and Season number - invalid."},
		{'Doctor Who (British series 1)', "Debug: Using a valid format with an extended Country and Season number - valid."},
		{'Doctor Who (UK series 1)', "Debug: Using a valid format with an extended Country and Season number - invalid."},
		{'Dallas (1978 TV series, season 1)', "Debug: Using a valid format with an extended Year and Season number - valid."},
		{'Dallas (1978 TV series, season 01)', "Debug: Using a valid format with an extended Year and Season number - invalid."},
		{'Dallas (197 TV series, season 1)', "Debug: Using a valid format with an extended Year and Season number - invalid."},
		{'Dallas (1978 TV series, series 1)', "Debug: Using a valid format with an extended Year and Season number - valid."},
		{'Dallas (197 TV series, series 1)', "Debug: Using a valid format with an extended Year and Season number - invalid."},
		{'Lost (season one)', "Debug: Using a valid format but using an incorrect extended style."},
		{'Lost (American season one)', "Debug: Using a valid format but using an incorrect extended style."},
		{'Dallas (1978 TV series, season one)', "Debug: Using a valid format but using an incorrect extended style."},
		{'Lost (season 1, TV series)', "Debug: Using a valid format but using an incorrect extended style."},
		{'Big Brother 1 (American season)', "Debug: Using a valid format with a Country and the word Season - valid."},
		{'Big Brother 1 (U.S. season)', "Debug: Using a valid format with a Country and the word Season - invalid."}
	})
end

function p:test_4_exception_list_sandbox()
	self:preprocess_equals_many('{{#invoke:Infobox television season disambiguation check/sandbox|test|', '}}', {
		{'List of The Tonight Show Starring Johnny Carson episodes (1983)', "Debug: Title on exception list."},
	})
end

function p:test_6_other_infoboxes_sandbox()
	self:preprocess_equals_many('{{#invoke:Infobox television season disambiguation check/sandbox|test|', '}}', {
		{'Big Brother (Russian TV series)', "Debug: Using incorrect infobox - ^%D+ TV series."},

	})
end

return p