File: TypeCompatibilityTest.py

package info (click to toggle)
pyjamas 0.7~%2Bpre2-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 10,656 kB
  • ctags: 12,331
  • sloc: python: 74,493; php: 805; sh: 291; makefile: 59; xml: 9
file content (28 lines) | stat: -rw-r--r-- 623 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from UnitTest import UnitTest

from write import write, writebr


def add(arg1, arg2):
    return arg1 + arg2


class TypeCompatibilityTest(UnitTest):

    def test_string_plus_number(self):
        try:
            add("string", 1)
        except TypeError:
            pass
        else:
            self.fail('adding "string" and 1 should fail')

        try:
            add(1, "string")
        except TypeError:
            pass
        else:
            self.fail('adding 1 and "string" should fail')

#         self.assertRaises(TypeError, add, "string", 1)
#         self.assertRaises(TypeError, add, 1, "string")