hamcrest/PyHamcrest — pull request #26 by alexander-beedie (2012-10-21 15:36:56+00:00)
Title: Improve "isnumeric" test inside 

The existing test for "isnumeric" was _extremely_ restrictive, passing only if "value" was an instance of int/float/long.

The test would fail incorrectly for (amongst many others) perfectly reasonable numpy scalar and decimal values, etc. Better to duck-check; if an object doesn't throw on math.fabs (which will be used in the real test) and if it supports basic math operators, then it should be considered numeric for the purposes of this test.

Additionally, failing the duck-type with an ArithmeticError (while I can't actually see any realistic chance of this) would still indicate the value is numeric, so it should be allowed to fail at a later stage, but should not fail the "isnumeric" test.