def test_parse_ok(self): '''Should parse a simple OK assertion''' assertion = TapAssertion.parse('ok 1') self.assertIsNotNone(assertion) self.assertEqual(assertion.num, 1) self.assertEqual(assertion.success, True) self.assertEqual(assertion.parsed_indent, '') self.assertEqual(assertion.message, None) self.assertEqual(assertion.expected, None) self.assertEqual(assertion.got, None) self.assertListEqual(assertion.stack, [])
def test_parse_not_ok_with_message(self): '''Should parse a NOT OK assertion with message''' assertion = TapAssertion.parse('not ok 284 - I should be equal to me.') self.assertIsNotNone(assertion) self.assertEqual(assertion.num, 284) self.assertEqual(assertion.success, False) self.assertEqual(assertion.parsed_indent, '') self.assertEqual(assertion.message, 'I should be equal to me.') self.assertEqual(assertion.expected, None) self.assertEqual(assertion.got, None) self.assertListEqual(assertion.stack, [])
def test_parse_not_ok(self): '''Should parse a simple NOT OK assertion''' assertion = TapAssertion.parse('not ok 2') self.assertIsNotNone(assertion) self.assertEqual(assertion.num, 2) self.assertEqual(assertion.success, False) self.assertEqual(assertion.parsed_indent, '') self.assertEqual(assertion.message, None) self.assertEqual(assertion.expected, None) self.assertEqual(assertion.got, None) self.assertListEqual(assertion.stack, [])
def test_parse_not_ok_with_all(self): '''Should parse a NOT OK assertion with all extras''' line = "not ok 42 - reset should not modify test status, expected: 'something', got: 'something else', source: at http://localhost:8000/static/js/test/libs/qunit.js:435" assertion = TapAssertion.parse(line) self.assertIsNotNone(assertion) self.assertEqual(assertion.num, 42) self.assertEqual(assertion.success, False) self.assertEqual(assertion.parsed_indent, '') self.assertEqual(assertion.message, 'reset should not modify test status') self.assertEqual(assertion.expected, 'something') self.assertEqual(assertion.got, 'something else') self.assertListEqual(assertion.stack, ['http://localhost:8000/static/js/test/libs/qunit.js:435'])
def test_parse_not_ok_with_expectations(self): '''Should parse a NOT OK assertion with expectations''' line = "not ok 42 - expected: 'something', got: 'something else'" assertion = TapAssertion.parse(line) self.assertIsNotNone(assertion) self.assertEqual(assertion.num, 42) self.assertEqual(assertion.success, False) self.assertEqual(assertion.parsed_indent, '') self.assertEqual(assertion.message, None) self.assertEqual(assertion.expected, 'something') self.assertEqual(assertion.got, 'something else') self.assertListEqual(assertion.stack, [])
def test_parse_not_ok_with_source(self): '''Should parse a NOT OK assertion with message and source''' line = 'not ok 298 - reset should not modify test status, source: at http://localhost:8000/static/js/test/libs/qunit.js:435' assertion = TapAssertion.parse(line) self.assertIsNotNone(assertion) self.assertEqual(assertion.num, 298) self.assertEqual(assertion.success, False) self.assertEqual(assertion.parsed_indent, '') self.assertEqual(assertion.message, 'reset should not modify test status') self.assertEqual(assertion.expected, None) self.assertEqual(assertion.got, None) self.assertListEqual(assertion.stack, ['http://localhost:8000/static/js/test/libs/qunit.js:435'])
def test_parse_not_ok_with_source(self): '''Should parse a NOT OK assertion with message and source''' line = ( 'not ok 298 - reset should not modify test status, ' 'source: at http://localhost:8000/static/js/test/libs/qunit.js:435' ) assertion = TapAssertion.parse(line) self.assertIsNotNone(assertion) self.assertEqual(assertion.num, 298) self.assertEqual(assertion.success, False) self.assertEqual(assertion.parsed_indent, '') self.assertEqual(assertion.message, 'reset should not modify test status') self.assertEqual(assertion.expected, None) self.assertEqual(assertion.got, None) self.assertListEqual(assertion.stack, ['http://localhost:8000/static/js/test/libs/qunit.js:435'])
def test_parse_not_ok_with_all(self): '''Should parse a NOT OK assertion with all extras''' line = "not ok 42 - reset should not modify test status, expected: 'something', got: 'something else', source: at http://localhost:8000/static/js/test/libs/qunit.js:435" assertion = TapAssertion.parse(line) self.assertIsNotNone(assertion) self.assertEqual(assertion.num, 42) self.assertEqual(assertion.success, False) self.assertEqual(assertion.parsed_indent, '') self.assertEqual(assertion.message, 'reset should not modify test status') self.assertEqual(assertion.expected, 'something') self.assertEqual(assertion.got, 'something else') self.assertListEqual( assertion.stack, ['http://localhost:8000/static/js/test/libs/qunit.js:435'])