"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test_suite/formatting.py" between
relax-4.1.3.src.tar.bz2 and relax-5.0.0.src.tar.bz2

About: relax allows the study of molecular dynamics through the analysis of experimental NMR data. Organic molecules, proteins, RNA, DNA, sugars, and other biomolecules are all supported.

formatting.py  (relax-4.1.3.src.tar.bz2):formatting.py  (relax-5.0.0.src.tar.bz2)
############################################################################### ###############################################################################
# # # #
# Copyright (C) 2007,2011-2012 Edward d'Auvergne # # Copyright (C) 2007,2011-2012,2019 Edward d'Auvergne #
# # # #
# This file is part of the program relax (http://www.nmr-relax.com). # # This file is part of the program relax (http://www.nmr-relax.com). #
# # # #
# This program is free software: you can redistribute it and/or modify # # This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by # # it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or # # the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. # # (at your option) any later version. #
# # # #
# This program is distributed in the hope that it will be useful, # # This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of # # but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. # # GNU General Public License for more details. #
# # # #
# You should have received a copy of the GNU General Public License # # You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. # # along with this program. If not, see <http://www.gnu.org/licenses/>. #
# # # #
############################################################################### ###############################################################################
# Python module imports. # Python module imports.
import sys import sys
from textwrap import wrap
def divider(char, width=100):
"""Write out a divider of the given width.
@param char: The character to use for the divider.
@type char: str
@keyword width: The number of characters to use.
@type width: int
"""
# Write out the divider.
sys.stdout.write(char*width)
sys.stdout.write("\n")
def format_test_name(test_name, category=None):
"""Generate the compact string representation of the test name.
@param test_name: The original TestCase name.
@type test_name: str
@keyword category: The test category, one of 'system', 'unit', 'gui', or 'v
erification'.
@type category: str
"""
# Change the test name for all but unit tests.
if category != 'unit':
test_name = test_name.split('.')
test_name = "%s.%s" % (test_name[-2], test_name[-1])
# Handle errors.
elif search('Error', test_name):
pass
# Modify the unit test name.
else:
# Strip out the leading 'test_suite.unit_tests.' text.
test_name = test_name.replace('test_suite.unit_tests.', '')
# Split out the module name from the test name.
module_name, test_name = split('.Test_', test_name)
# Rebuild the test name.
test_name = "module %s, test Test_%s" % (module_name, test_name)
# Return the test name.
return test_name
def subtitle(text): def subtitle(text):
"""Function for printing the subtitles. """Function for printing the subtitles.
@param text: The text of the subtitle to be printed. @param text: The text of the subtitle to be printed.
@type text: str @type text: str
""" """
# The width of the subtitle string. # The width of the subtitle string.
width = len(text) + 2 width = len(text) + 2
skipping to change at line 75 skipping to change at line 121
state = "Failed" state = "Failed"
# Dots. # Dots.
dots = '' dots = ''
for j in range(width - len(name) - len(state) - 6): for j in range(width - len(name) - len(state) - 6):
dots += '.' dots += '.'
# Write out the line. # Write out the line.
sys.stdout.write("%s %s [ %s ]\n" % (name, dots, state)) sys.stdout.write("%s %s [ %s ]\n" % (name, dots, state))
def test_title(name, desc=None, width=100):
"""Format and write out a title for the test.
@param name: The name of the test.
@type name: str
@keyword desc: An optional description for the test.
@type desc: str
@keyword width: The console width.
@type width: int
"""
# Output the title.
divider('=', width=width)
sys.stdout.write("Starting test: %s\n" % name)
if desc:
sys.stdout.write("\n")
for line in wrap(desc, width):
sys.stdout.write("%s\n" % line)
divider('-', width=width)
def title(text): def title(text):
"""Function for printing the titles. """Function for printing the titles.
@param text: The text of the title to be printed. @param text: The text of the title to be printed.
@type text: str @type text: str
""" """
# The width of the title string. # The width of the title string.
width = len(text) + 4 width = len(text) + 4
 End of changes. 3 change blocks. 
1 lines changed or deleted 68 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)