File: ExampleWithAssertThat.py

package info (click to toggle)
pyhamcrest 2.1.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 844 kB
  • sloc: python: 4,081; makefile: 114; sh: 15
file content (23 lines) | stat: -rw-r--r-- 553 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import sys

sys.path.append("..")

from hamcrest import *
import unittest


class ExampleWithAssertThat(unittest.TestCase):
    def testUsingAssertThat(self):
        assert_that("xx", is_("xx"))
        assert_that("yy", is_not("xx"))
        assert_that("i like cheese", contains_string("cheese"))

    def testCanAlsoSupplyDescriptiveReason(self):
        assert_that("xx", is_("xx"), "description")

    def testCanAlsoAssertPlainBooleans(self):
        assert_that(True, "This had better not fail")


if __name__ == "__main__":
    unittest.main()