local p = require('Module:UnitTests')
function p:testGallery -- known link self:preprocess_equals('', 'Mount Whitney') -- known link with linktext self:preprocess_equals('', 'Big Mountain') -- forced search self:preprocess_equals('', 'Mount Whitney') -- forced search + linktext self:preprocess_equals('', 'Big Mountain') -- P935 matches sitelink self:preprocess_equals('', 'Samuel Baker House') -- P935 matches sitelink + linktext self:preprocess_equals('', 'Big House') -- sitelink only self:preprocess_equals('', 'Bellows Falls, Vermont') -- sitelink + linktext self:preprocess_equals('', 'Little Town') -- sitelink and P935 inconsistent self:preprocess_equals('', 'Boeing 737 MAX') -- sitelink and P935 inconsistent + linktext self:preprocess_equals('', 'Not a plane') -- no sitelink or P935 self:preprocess_equals('', 'Bell FCX-001') -- no sitelink or P935, but linktext self:preprocess_equals('', 'Medium Helicopter')end
function p:testCategory -- known link self:preprocess_equals('', 'Mount Whitney') -- known link with linktext self:preprocess_equals('', 'Big Mountain') -- forced search self:preprocess_equals('', 'Mount Whitney') -- forced search + linktext self:preprocess_equals('', 'Big Mountain') -- P373 matches sitelink self:preprocess_equals('', 'Agama lionotus') -- P373 matches sitelink + linktext self:preprocess_equals('', 'Small Lizard') -- P910 matches P373 self:preprocess_equals('', 'Bánhida') -- P910 matches P373 + linktext self:preprocess_equals('', 'Old Neighborhood') -- P1754 matches P373 self:preprocess_equals('', 'Lakes of Turkey') -- P1754 matches P373 + linktext self:preprocess_equals('', 'Turkey Lakes') -- inconsistency between P373 and P1754 self:preprocess_equals('', 'Municipality of Vipava') -- inconsistency between P373 and P1754 + linktext self:preprocess_equals('', 'Little Town') -- missing data self:preprocess_equals('', 'Chicago Lawn, Chicago') -- missing data + linktext self:preprocess_equals('', 'Big Neighborhood') end
function p:testGalleryOrCategory -- known link self:preprocess_equals('', 'Mount Whitney') -- known link with linktext self:preprocess_equals('', 'Big Mountain') -- forced search self:preprocess_equals('', 'Mount Whitney') -- forced search + linktext self:preprocess_equals('', 'Big Mountain') -- P935 matches sitelink self:preprocess_equals('', 'Samuel Baker House') -- sitelink only self:preprocess_equals('', 'Bellows Falls, Vermont') -- sitelink and P935 inconsistent, fallback to Category instead self:preprocess_equals('', 'Boeing 737 MAX') -- no sitelink or P935 or category self:preprocess_equals('', 'Bell FCX-001') -- P373 matches sitelink self:preprocess_equals('', 'Agama lionotus') -- P910 matches P373 self:preprocess_equals('', 'Bánhida') -- P1754 matches P373 self:preprocess_equals('', 'Lakes of Turkey') -- missing gallery, inconsistent category self:preprocess_equals('', 'Municipality of Vipava') -- missing data self:preprocess_equals('', 'Chicago Lawn, Chicago')end
function p:testTitleQID self:preprocess_equals('','Sandbox/Hike395/CommonsLink2/testcases,829,nil') self:preprocess_equals('','Douglas Adams,829,Q42') self:preprocess_equals('','Python,829,Q15048757')end
function p:testLookupFallback -- P910 doesn't exist self:preprocess_equals('','nil') -- P910 exists, but isn't a category self:preprocess_equals('','nil') -- normal P910 self:preprocess_equals('','Bánhida') -- normal P1754 self:preprocess_equals('','Lakes of Turkey')end
return p