Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (20 sloc) 0.623 kb
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")
Jump to Line
Something went wrong with that request. Please try again.