Пример #1
0
 def test_get_rows(self):
     """simple call of get_rows method and check rows count"""
     EXPECTED = 2
     config_file = parser.process_layout_config(DEFAULT_CONFIG_NAME)
     found_rows = parser._get_rows(config_file['layout'])
     rows_count = len(found_rows)
     msg = u'Found {} rows instead of expected {}'.format(
         rows_count, EXPECTED)
     self.assertEqual(rows_count, EXPECTED, msg)
Пример #2
0
 def test_get_rows(self):
     """simple call of get_rows method and check rows count"""
     EXPECTED = 2
     config_file = parser.process_layout_config(DEFAULT_CONFIG_NAME)
     found_rows = parser._get_rows(config_file['layout'])
     rows_count = len(found_rows)
     msg = u'Found {} rows instead of expected {}'.format(
         rows_count, EXPECTED
     )
     self.assertEqual(rows_count, EXPECTED, msg)
Пример #3
0
 def test_get_rows_cols_validator(self):
     """
     negative test: checks if parser's get_rows method find wrong rows count
     """
     config_file = parser.process_layout_config(DEFAULT_CONFIG_NAME)
     broken_layout = config_file['layout'][:]
     popped_row = broken_layout.pop()
     row_class, cols_data = popped_row.items()[0]
     broken_key = row_class.replace('1', '5')
     broken_row = {
         broken_key: cols_data,
     }
     broken_layout.append(broken_row)
     try:
         parser._get_rows(broken_layout)
     except parser.WrongSumOfRows:
         # test passed
         pass
     else:
         raise Exception("Parser's get_rows method skipped layout error")
Пример #4
0
 def test_get_rows_cols_validator(self):
     """
     negative test: checks if parser's get_rows method find wrong rows count
     """
     config_file = parser.process_layout_config(DEFAULT_CONFIG_NAME)
     broken_layout = config_file['layout'][:]
     popped_row = broken_layout.pop()
     row_class, cols_data = popped_row.items()[0]
     broken_key = row_class.replace('1', '5')
     broken_row = {
         broken_key: cols_data,
     }
     broken_layout.append(broken_row)
     try:
         parser._get_rows(broken_layout)
     except parser.WrongSumOfRows:
         # test passed
         pass
     else:
         raise Exception("Parser's get_rows method skipped layout error")