def testSetFromSrcLineDoubleComment(self):
     test_input = '  # Comment # More comment\n'
     test_node = create_node.SyntaxFreeLine()
     test_node.SetFromSrcLine(test_input)
     self.assertEqual(test_node.col_offset, 2)
     self.assertEqual(test_node.comment_indent, 1)
     self.assertEqual(test_node.comment, 'Comment # More comment')
 def testSetFromSrcLineVeryShortComment(self):
     test_input = '#\n'
     test_node = create_node.SyntaxFreeLine()
     test_node.SetFromSrcLine(test_input)
     self.assertEqual(test_node.col_offset, 0)
     self.assertEqual(test_node.comment_indent, 0)
     self.assertEqual(test_node.comment, '')
 def testSetFromSrcLineEmpty(self):
     test_input = '\n'
     test_node = create_node.SyntaxFreeLine()
     test_node.SetFromSrcLine(test_input)
     self.assertEqual(test_node.col_offset, 0)
     self.assertEqual(test_node.comment_indent, 0)
     self.assertEqual(test_node.comment, None)
 def testSetFromSrcLineNoComment(self):
     test_input = '  Comment\n'
     test_node = create_node.SyntaxFreeLine()
     with self.assertRaises(ValueError):
         test_node.SetFromSrcLine(test_input)
 def testCommentIndent(self):
     expected_string = '  # Comment'
     test_node = create_node.SyntaxFreeLine(comment='Comment',
                                            col_offset=2,
                                            comment_indent=1)
     self.assertEqual(expected_string, test_node.full_line)
 def testEmpty(self):
     expected_string = ''
     test_node = create_node.SyntaxFreeLine(comment=None)
     self.assertEqual(expected_string, test_node.full_line)