Jump to content

Module:Infobox television season disambiguation check/testcases

From Wikipedia, the free encyclopedia
-- Unit tests for [[Module:Infobox television season disambiguation check]]. Click talk page to run tests.
local p = require('Module:UnitTests')

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

function p:test_2_incorrect_infobox()
	self:preprocess_equals_sandbox_many('{{#invoke:Infobox television season disambiguation check', 'test', {
		{'Lost (TV series)', "Debug: Using incorrect infobox - ^[^,]*TV series$."},
		{'Lost (TV program)', "Debug: Using incorrect infobox - TV program."},
		{'Lost (TV programme)', "Debug: Using incorrect infobox - TV program."},
		{'Lost (TV film)', "Debug: Using incorrect infobox - TV film."},
		{'Lost (film)', "Debug: Using incorrect infobox - film."},
		{'Lost (miniseries)', "Debug: Using incorrect infobox - miniseries."},
		{'Lost (serial)', "Debug: Using incorrect infobox - serial."},
		{'Lost (game show)', "Debug: Using incorrect infobox - game show."},
		{'Lost (talk show)', "Debug: Using incorrect infobox - talk show."},
		{'Lost (web series)', "Debug: Using incorrect infobox - web series."},
		{'Big Brother (Russian TV series)', "Debug: Using incorrect infobox - ^[^,]*TV series$."},
		{'Doraemon (2005 TV series)', "Debug: Using incorrect infobox - ^[^,]*TV series$."}
	})
end	

function p:test_3_invalid_formats()
	self:preprocess_equals_sandbox_many('{{#invoke:Infobox television season disambiguation check', 'test', {
		{'Lost (bad disambiguation)', "Debug: Not a valid format."}, 
		{'Lost (soap opera)', "Debug: Not a valid format."},
		{'Lost (anime)', "Debug: Not a valid format."},
		{'El Gran Show (Reyes del Show of 2017)', "Debug: Not a valid format."},
		{'List of Digimon Tamers episodes', "Debug: Not a valid format."},
		{'List of Digimon Tamers (season 3) episodes', "Debug: Not a valid format."}
	})
end	

function p:test_4_extended_disamiguation_valid()
	self:preprocess_equals_sandbox_many('{{#invoke:Infobox television season disambiguation check', 'test', {
		{'Lost season 1', "Debug: Using a valid format with a Season number - valid."},
		{'Doctor Who series 1', "Debug: Using a valid format with a Season number - valid."},		
		{'Lost (American TV series) season 1', "Debug: Using a valid format with an extended Country and Season number - valid."},
		{'Doctor Who (British TV series) series 1', "Debug: Using a valid format with an extended Country and Season number - valid."},		
		{'Dallas (1978 TV series) season 1', "Debug: Using a valid format with an extended Year and Season number - valid."},		
		{'Dallas (1978 TV series) series 1', "Debug: Using a valid format with an extended Year and Season number - valid."},		
		{'Love Island (British TV series) series 1', "Debug: Using a valid format with an extended Country and Season number - valid."},
		{'Gladiators (2008 British TV series) series 2', "Debug: Using a valid format with an extended Year, Country and Season number - valid."},
		{'Big Brother 1 (American season)', "Debug: Using a valid format with a Country and the word Season - valid."},		
	})
end

function p:test_5_extended_disamiguation_invalid()
	self:preprocess_equals_sandbox_many('{{#invoke:Infobox television season disambiguation check', 'test', {
		{'Lost (season 1)', "Debug: Using a valid format with a Season number - valid."},
		{'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."},
		{'Doctor Who (British series 1)', "Debug: Using a valid format with an extended Country and Season number - valid."},		
		{'Dallas (1978 TV series, season 1)', "Debug: Using a valid format with an extended Year and Season number - valid."},		
		{'Dallas (1978 TV series, series 1)', "Debug: Using a valid format with an extended Year and Season number - valid."},		
		{'Love Island (British TV series, series 1)', "Debug: Using a valid format with an extended Country and Season number - valid."},
		{'Gladiators (2008 British TV series, series 2)', "Debug: Using a valid format with an extended Year, Country and Season number - valid."},
		{'Big Brother 1 (American season)', "Debug: Using a valid format with a Country and the word Season - valid."},		
	})
end

function p:test_6_extended_disamiguation_invalid()
	self:preprocess_equals_sandbox_many('{{#invoke:Infobox television season disambiguation check', 'test', {
		{'Lost (season 01)', "Debug: Using a valid format with a Season number - invalid."},
		{'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 (UK series 1)', "Debug: Using a valid format with an extended Country and Season number - invalid."},
		{'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 (197 TV series, series 1)', "Debug: Using a valid format with an extended Year and Season number - invalid."},
		{'Big Brother 1 (U.S. season)', "Debug: Using a valid format with a Country and the word Season - invalid."},
		{'Gladiators (200 British TV series, series 2)', "Debug: Using a valid format with an extended Year, Country and Season number - invalid."},
		{'Gladiators (British 2008 TV series, series 2)', "Debug: Using a valid format but using an incorrect extended style."},
		{'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."},
		{'El Gran Show (season 1 of 2010)', "Debug: Using a valid format but using an incorrect extended style."}	
	})
end

function p:test_6_exception_list()
	self:preprocess_equals_sandbox_many('{{#invoke:Infobox television season disambiguation check', 'test', {
		{'Bigg Boss (Hindi season 12)', "Debug: Title on exception list."},
	})
end

return p