Ejemplo n.º 1
0
 def test__first_comment_line_added_right(self):
     data = {
         'commands': {
             'my_command': {
                 'done': False
             }
         }
     }
     line = 'This is the first line for the main comment..'
     expected = {
         'commands': {
             'my_command': {
                 'description': 'This is the first line for the main comment..',
                 'done': False
             }
         }
     }
     expected_state = state.command_comment
     next_state = state.command_comment(data, line)
     self.assertEqual(expected, data)
     self.assertEqual(expected_state, next_state)
Ejemplo n.º 2
0
 def test__comment_delimiter_ends_the_comment_capturing(self):
     data = {
         'commands': {
             'my_command': {
                 'description': 'Some text.\n\n',
                 'done': False
             }
         }
     }
     line = '"""'
     expected = {
         'commands': {
             'my_command': {
                 'description': 'Some text.\n\n',
                 'done': False
             }
         }
     }
     expected_state = state.pre
     next_state = state.command_comment(data, line)
     self.assertEqual(expected, data)
     self.assertEqual(expected_state, next_state)
Ejemplo n.º 3
0
 def test__next_not_empty_line_appended_nicely(self):
     data = {
         'commands': {
             'my_command': {
                 'description': 'Some text.\n\n',
                 'done': False
             }
         }
     }
     line = 'vmi'
     expected = {
         'commands': {
             'my_command': {
                 'description': 'Some text.\n\nvmi',
                 'done': False
             }
         }
     }
     expected_state = state.command_comment
     next_state = state.command_comment(data, line)
     self.assertEqual(expected, data)
     self.assertEqual(expected_state, next_state)
Ejemplo n.º 4
0
 def test__second_empty_line_does_not_add_more_seaprators(self):
     data = {
         'commands': {
             'my_command': {
                 'description': 'Some text.\n\n',
                 'done': False
             }
         }
     }
     line = ''
     expected = {
         'commands': {
             'my_command': {
                 'description': 'Some text.\n\n',
                 'done': False
             }
         }
     }
     expected_state = state.command_comment
     next_state = state.command_comment(data, line)
     self.assertEqual(expected, data)
     self.assertEqual(expected_state, next_state)
Ejemplo n.º 5
0
 def test__empty_line_acts_as_a_separator__appends_two_lines_to_the_end(self):
     data = {
         'commands': {
             'my_command': {
                 'description': 'Some text.',
                 'done': False
             }
         }
     }
     line = ''
     expected = {
         'commands': {
             'my_command': {
                 'description': 'Some text.\n\n',
                 'done': False
             }
         }
     }
     expected_state = state.command_comment
     next_state = state.command_comment(data, line)
     self.assertEqual(expected, data)
     self.assertEqual(expected_state, next_state)
Ejemplo n.º 6
0
 def test__extra_whitespaces_will_be_ignored(self):
     data = {
         'commands': {
             'my_command': {
                 'description': 'Some text..',
                 'done': False
             }
         }
     }
     line = '         \t\tThis should be appended..    \t   '
     expected = {
         'commands': {
             'my_command': {
                 'description': 'Some text.. This should be appended..',
                 'done': False
             }
         }
     }
     expected_state = state.command_comment
     next_state = state.command_comment(data, line)
     self.assertEqual(expected, data)
     self.assertEqual(expected_state, next_state)
Ejemplo n.º 7
0
 def test__another_line_appended_with_a_space_to_the_existing_ones(self):
     data = {
         'commands': {
             'my_command': {
                 'description': 'Some text..',
                 'done': False
             }
         }
     }
     line = 'This should be appended..'
     expected = {
         'commands': {
             'my_command': {
                 'description': 'Some text.. This should be appended..',
                 'done': False
             }
         }
     }
     expected_state = state.command_comment
     next_state = state.command_comment(data, line)
     self.assertEqual(expected, data)
     self.assertEqual(expected_state, next_state)