Added from #494 (as they pass now).
(grafted from 4855ca9d98406524bd73cc2399a073445cab9e55)

--HG--
extra : source : 4855ca9d98406524bd73cc2399a073445cab9e55
Merge pull request #584 from iskiselev/Issue494_Tests

Added some tests (as they pass now).