def test_square_2(self): self.addDetail('arbitrary-color-name', text_content('blue')) self.addDetail( 'log-file', Content(UTF8_TEXT, lambda: open('log.txt', 'r').readlines())) result = silly.square(7) self.assertThat(result, Equals(49))
def test_square(self): def cleanup(): print "addCleanup" self.addCleanup(cleanup) result = silly.square(7) self.assertEqual(result, 49) # it is implmented using assertThat anyway
def test_square_bad_input_2(self): with ExpectedException(TypeError, "can't multiply.*"): silly.square('organge')
def test_square_2(self): self.addDetail('arbitrary-color-name', text_content('blue')) self.addDetail('log-file', Content(UTF8_TEXT, lambda: open('log.txt', 'r').readlines())) result = silly.square(7) self.assertThat(result, Equals(49))