Commit graph

78 commits

Author SHA1 Message Date
Andrew Ekstedt
de27f2c282 Fix test for missing default forms 2021-03-14 18:12:58 -07:00
Andrew Ekstedt
a91a7d95b3 Allow small ッ before a vowel
This is a nonstandard use of ッ and it doesn't really have a defined
romanization, but we need to support it for Cramorant (ウッウ, U'u).
2021-03-07 11:26:50 -08:00
Andrew Ekstedt
ad429ab128 Fix Roserade's Central Kalos dex number and add tests
Roserade and Roselia were mistakenly sharing dex number 72. Presumably
an error from the original X/Y spreadsheet. I guess we never reripped
these after 3DS rom dumping became possible.

Regardless of how it happened, add a test and some database constraints
to ensure that it doesn't happen again.

- Add a test for gaps in pokedex numbers

- Add uniqueness constraints to pokemon_dex_numbers.  A species can
  only appear once per pokedex, and a number cannot be used more than
  once per pokedex.
2019-07-16 18:12:58 -07:00
Andrew Ekstedt
db824220d0
Merge pull request #238 from jrubinator/record-gift-pokemon
Record gift pokemon
2019-07-12 19:40:29 -07:00
Andrew Ekstedt
8161bd84e4 gift-pokemon: fix Cosplay Pikachu and Sinnoh starter gift locations
Cosplay Pikachu was listed as being encountered in contest-hall, but
that's a Sinnoh location. In OR/AS, the contest halls are not a
first-class location but rather just treated as part of the town or city
they are in. Cosplay Pikachu is given to the player after they
participate in their first contest, so its location can be any of the
four cities with a contest hall.

The Sinnoh starter that the player obtains in OR/AS is on Hoenn Route
101, not Sinnoh Route 201 (probably a copy/paste error).

Add a test to make sure that encounter regions always match the
region(s) that their game takes place in.
2019-07-12 18:48:07 -07:00
Andrew Ekstedt
1d3dd33cbb Sigh, fix Python 3 syntax
Python 3 doesn't allow the ur'' prefix for raw unicode strings.
We want a unicode string here so that we get a unicode regexp,
so drop the r and do the escaping explicitly (the regexp in question
is pretty simple, fortunately).
2018-09-29 11:56:40 -07:00
Andrew Ekstedt
9a8918135f Region-prefix some locations identifiers, and add a test
Unova Routes 19-23 were added in B/W 2 and i forgot to prefix them when
we added the locations. Kalos Victory Road used to have a prefix but it
got dropped when i re-ripped X/Y locations. Kalos Pokemon League gets a
prefix too, since both Sinnoh and Alola also have Pokemon Leagues.

Add a test to ensure that we don't forget again in the future.
2018-09-29 11:35:13 -07:00
Andrew Ekstedt
e6b64b8c5a Relax test for nullability of translation columns
The previous commit added a nullable subtitle field to location_names.
This caused a test in test_schema.py to fail because the name field
wasn't also nullable.

A comment above the test says, "If there's more than one text column in a
translation table they have to be nullable, to support missing
translations", but i don't think that logic holds in this case.

The idea is that we might have a translation for the subtitle, but not
the name, or vice versa, so both need to be nullable in case one or the
other is missing. But in this particular case that doesn't make sense:
if you don't have a name, you don't have a location; it may or may not
have a subtitle, but a location will always have a name.

Therefore, add an exception to the test.
2018-09-29 10:12:10 -07:00
Andrew Ekstedt
56cf0fd29d Squash a bunch of "non-unicode bind param" warnings 2018-03-30 12:14:55 -07:00
Eevee (Lexy Munroe)
73f388ed69 Fix tests, since Farfetch’d got a name change 2017-09-04 10:04:23 -07:00
Eevee (Lexy Munroe)
2af13f4f15 Fix references to "ja" (which is now ja-Hrkt) 2017-06-18 00:15:05 -07:00
John T. Wodder II
c3f566b2c9 Addressed all of pyflakes3's complaints 2016-11-24 21:29:58 +00:00
Eevee (Alex Munroe)
b76b74e7a6 Compat with Python 3.3+ 2015-10-05 08:12:23 -07:00
Andrew Ekstedt
9a4683c0c1 Fix the util.order_by_name test, for real this time. 2015-05-28 19:47:24 -07:00
Andrew Ekstedt
02b1968bc5 "Fix" MultilangQuery.
SQLAlchemy 1.0 sets bindpararms to their default values when loading
lazy-loaded columns. This is in contrast to the 0.9 behaviour of
ignoring our incongruous bindparam alltogether.

So MultilangQuery is still broken, but now it breaks in the same way as before.

While we're here, set the correct param in one of the multilang tests. Not that
it matters.
2015-05-23 18:26:09 -07:00
Andrew Ekstedt
2cfc78edac Fix util.order_by_name test.
Électrik sorts last because it has an accent now.
2015-05-23 18:26:09 -07:00
Andrew Ekstedt
0094e9584c Modernize our use of py.test
This commit updates the tests to take advantage of some of py.test's
newer features.  Requires py.test 2.3 or newer.  Tested with 2.3.0 and
2.5.2.

Tests which were parametrized now use py.test's built-in
parametrization[1].

The session and lookup objects are now implemented as fixtures[2].
The media root is a fixture as well.  Fixtures are automatically passed
to any function that expects them.

Since the session is now created in one place, it is now possible to
provide an engine URI on the command line when running py.test.  Ditto
for the index directory.  (But the environment variables still work of
course.)

Slow tests are now marked as such and not run unless the --all option is
given.

A couple media tests are marked as xfail (expected to fail) because they
are broken.

[1]: http://pytest.org/latest/parametrize.html
[2]: http://pytest.org/latest/fixture.html
2014-07-06 21:45:05 -07:00
Andrew Ekstedt
6f5abb9540 Put column descriptions where they belong
The Column class accepts a 'doc' argument. Use it.

And while we're at it, make them all unicode strings.

Performed by the following sed script:

   s/info=dict(description=u\?\("[^"]*"\))/doc=u\1/
   s/info=dict(description=u\?\('[^']*'\))/doc=u\1/
   s/\(\s*\)info=dict(description=u\?\("[^"]*"\), /\1doc=u\2,\n\1info=dict(/
   s/\(\s*\)info=dict(description=u\?\('[^']*'\), /\1doc=u\2,\n\1info=dict(/

   /info=dict(description=u\?\('[^']*'\),$/ {
       s//doc=u\1,/
       n
       s/^\s*/&info=dict(/
   }
2014-07-05 16:46:37 -07:00
Lynn "Zhorken" Vaughan
5ec50ea26c Make the rest of the tests pass. 2013-11-09 03:49:09 -05:00
Andrew Ekstedt
ec5dd5177f Fairy Arceus is not a default form. 2013-10-29 02:54:36 -07:00
Andrew Ekstedt
b69a338138 Add a test for main-tables.rst 2012-06-10 15:46:50 -07:00
Andrew Ekstedt
14d9b6ead7 Fix test_media.py.
- Add --media-root option (was half-supported already, but not accepted
  on the command line).

- Don't test for Colosseum and XD graphics, since we have none.

- Acknowledge *-beta sprites.
2012-03-16 12:37:47 -07:00
Petr Viktorin
719c32de0b Make MarkdownString.as_html() accept an extension object, not class
No reason to instantiate every time as_html's called, is there?

Also, sessions use a markdown_extension attribute instead of
markdown_extension_class. The latter is only used to set the former when
the session is created (unless another markdown_extension_class is given,
of course).
2011-09-22 00:51:59 +03:00
Petr Viktorin
928eaca4a4 Make bad links in Markdown not fail
Links such as []{pokemon:mewthree} can come from users, so they should not
crash the parser.
So, when an object is not found (or more than one is found), call
identifier_url() directly, instead of failing to get the object for
object_url(). Essentially, treat the link as having an unknown category
(like mechanic:, currently).

The test that check the pokédex descriptions updated so that only
links to known objects and "mechanic:" are allowed.
2011-09-22 00:51:59 +03:00
Petr Viktorin
cdac374eed Allow links to Pokémon forms in Markdown. Fixes #465
Linked-to objects aren't required to have identifiers now, so object_url()
in custom extensions might need to be changed.
The one in the test did, for example.
2011-09-22 00:51:59 +03:00
Eevee
25ab674c7c Fix this markdown extension nonsense.
Previously, every single spline-pokedex request tacked another markdown
extension onto a global list in spline, making markdown processing just
a little bit slower over time.  This is terrible.

Now we do something a little less crazy and a little more global.  Wait,
is that less crazy or more?
2011-09-06 21:52:27 -07:00
Petr Viktorin
3dc8a4cbd0 Add a sanity check for PokemonForm.order 2011-09-05 11:20:16 +03:00
Petr Viktorin
41a168a0e2 Add a missing import, remove some unused ones 2011-08-30 23:05:22 +03:00
Petr Viktorin
332647c362 Switch to py.test #604 2011-05-06 12:40:44 +03:00
Petr Viktorin
c710457717 Pokemon species split: media accessors 2011-05-06 12:26:17 +03:00
Petr Viktorin
ab2baaa759 Update media accessors wrt repo split
All accessors now take a `root` arg, the root of the media tree.
Alternatively `root` can be a custom MediaFile subclass, which should allow
neat tricks like:
- Checking some kind of manifest to prevent stat() calls
- Custom properties of the file objects (e.g. for HTML <img> tags)
- Downloading the media on demand

Tests assume media is at pokedex/data/media, skip otherwise.
2011-05-06 12:26:17 +03:00
Petr Viktorin
dd0d225228 Pokemon species split: utilities.
Remove 'simple' altogether, as pokémon are now sane by default!
2011-05-06 12:26:16 +03:00
Petr Viktorin
bc7e9128e8 Pokemon species split: Tests 2011-05-06 12:26:16 +03:00
Eevee
349fbb2d94 Merge remote-tracking branch 'origin/encukou-markdown' 2011-04-28 19:40:20 -07:00
Petr Viktorin
7d7fcc74c8 Don't set autoincrement for ids with zeroes. Test included. #580 2011-04-28 23:45:43 +03:00
Petr Viktorin
b711edd511 Port the Markdown value tests from spline-pokedex. Fix remaining strings. 2011-04-28 23:43:54 +03:00
Petr Viktorin
85d779ba83 Move Markdown handling to the translation classes
- the Session has a `pokedex_link_maker` property, whose `object_url`
  method is used to make URLs in Markdown
- pokemon.names_table.name is now an ordinary Unicode column
- pokemon.name is a MarkdownString that is aware of the session and the
  language the string is in
- pokemon.name_map is a dict-like association_proxy of the above
- move.effect works similarly, with transparent $effect_chance substitution
  as before
2011-04-28 23:42:56 +03:00
Petr Viktorin
7767d546ac Don't recreate the lookup index in tests 2011-04-28 23:31:38 +03:00
Eevee
b2db58afc7 Fix discrepancy between media-accessors branches. 2011-04-17 22:35:24 -07:00
Petr Viktorin
69140a88f5 Move the rest of pokedex.util.get to pokedex.db.util 2011-04-17 22:34:05 -07:00
Petr Viktorin
f271812cf7 Break "simple" query functions out of pokedex.util.get 2011-04-17 22:34:05 -07:00
Petr Viktorin
2f014411e1 Add pokedex.util.get: helpers to get stuff out of the DB easily 2011-04-17 22:34:04 -07:00
Petr Viktorin
7292ede94a Test media accessors, and the media organization itself
A few tests of the accessors, along with a very dumb, long-running script
to ensure everything is in its proper place, and there's nothing but the
proper things.

For now it still finds some beta form cruft for Burmy, Pichu and Cherrim.
2011-04-17 20:55:58 -07:00
Eevee
8e1bbe0004 Merge remote-tracking branch 'origin/encukou-translations' 2011-04-17 17:43:42 -07:00
Petr Viktorin
10d9bc83b3 Mark MoveEffect.effect as a Markdown column.
Also relax the appropriate test
2011-04-12 09:51:51 +03:00
Petr Viktorin
5d18ae7ab6 Make the schema tests pass 2011-04-12 09:06:02 +03:00
Petr Viktorin
4c2ad2bdf1 Reading, merging, and writing translations 2011-04-11 17:03:27 +03:00
Eevee
08bfd753e0 Fix default language assignment once and for all.
Stop trying to be clever and magical and just make the caller pass in a
damn primary key.
2011-04-10 00:54:14 -07:00
Petr Viktorin
4291c33c00 Make MultilangSession's language class configurable 2011-04-04 21:51:35 +03:00
Petr Viktorin
a06498cb39 Make a bunch of text columns nullable to support missing translations 2011-04-03 20:08:05 +03:00