-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test: Correct several format IDs #10633
Changes from 3 commits
8450871
61c8bad
1d933ff
7078ff5
8a379a9
c049d31
208e834
dee503b
b26ff73
e9670c8
3497ecc
3c44bec
b65d38c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -163,7 +163,7 @@ describe('Mega Evolution', function () { | |||||
assertLegalButCantMega('gen9nationaldexag@@@-ndag'); | ||||||
|
||||||
// don't add it where unnecessary | ||||||
assert.false(Dex.formats.getRuleTable(Dex.formats.get('gen5anythinggoes')).has('megarayquazaclause')); | ||||||
assert.false(Dex.formats.getRuleTable(Dex.formats.get('gen4anythinggoes')).has('megarayquazaclause')); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just like Gen 5 AG, Gen 4 AG is not guaranteed to exist in the future. Can you fix this in a more reliable way? Even just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense, made the change suggested in the later comment. The code would now get this error message:
The other two instances of
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something similar for helpers that wrap pokemon-showdown/test/random-battles/tools.js Lines 179 to 180 in 7078ff5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about checking I suppose someone could construct a populated Format and add an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good. Except that I have just remembered that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Of course, this is likely surprising for many, but it's a direct consequence of the design or lack thereof of PS format system (not favoring either side, I can see the benefits of the current system, though certainly it can be improved). Also, these lines at type FormatEffectType = 'Format' | 'Ruleset' | 'Rule' | 'ValidatorRule';
this.effectType = Utils.getString(data.effectType) as FormatEffectType || 'Format'; Having said all that, I did forget these facts at the time of reading your quiz, because I have actually been a very inactive contributor. But, hey, that was the reason why I remembered and suggested that we should just check that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right. Since you are interested in the findEventHandlers situation, that link should be very useful to you. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I looked and it seems that the effectType convention for invalid Formats dates back to the start of the repo and the introduction of getFormat. Ah well. I just feel bad for the next person who has to infer why a I ended up going with Originalfor (const format of Object.keys(formatInfo)) {
const filename = formatInfo[format].filename;
const setsJSON = require(`../../dist/data/random-battles/${filename}.json`);
const mod = filename.split('/')[0];
const genNum = parseInt(mod[3]);
const rounds = 100;
const dex = Dex.forFormat(format);
console.log(format, genNum, dex.gen); =>
v2 (to demonstrate footgun in getFormat)for (const format of Object.keys(formatInfo)) {
const filename = formatInfo[format].filename;
const setsJSON = require(`../../dist/data/random-battles/${filename}.json`);
const dex = common.mod(common.getFormat(format).mod).dex; // .getFormat verifies format exists
console.log(format, dex.gen);
const rounds = 100; => gen2randombattle 9
gen3randombattle 9
gen4randombattle 9
gen5randombattle 9
gen6randombattle 9
gen7randombattle 9
gen9randombattle 9
gen9randomdoublesbattle 9
gen9babyrandombattle 9 Fails in a very non-obvious fashion. v3for (const format of Object.keys(formatInfo)) {
const filename = formatInfo[format].filename;
const setsJSON = require(`../../dist/data/random-battles/${filename}.json`);
const dex = common.mod(common.getFormat({formatid: format}).mod).dex; // verifies format exists
const genNum = dex.gen;
console.log(format, genNum);
const rounds = 100; =>
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feel free to use v3 if you prefer it. But it looks like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While we are still doing archaeology, I tracked the
Is TypeScript full of void promises??! |
||||||
}); | ||||||
}); | ||||||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this should be
bssregh
, since it's validating off of the base battle stadium format legality. Obviously a fix of checking ifgen9bssregh
exists would make sure people update this since there's no easy way to automate this apart from trying to assign an alias to the BSS format that's active inaliases.ts
, but if you can figure something else out I'm all ears.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All I could come up with so far is validating that the formats exist. The alias is an interesting idea, kind of like how 'base' is an alias for the current gen's dex.