diff --git a/uncertainties/test_uncertainties.py b/uncertainties/test_uncertainties.py index c5ed4ccc..88b7a688 100644 --- a/uncertainties/test_uncertainties.py +++ b/uncertainties/test_uncertainties.py @@ -1704,10 +1704,10 @@ def test_format(): (1234.56789, 0.1): { 'eL': r'\left(1.23457 \pm 0.00010\right) \times 10^{3}', 'EL': r'\left(1.23457 \pm 0.00010\right) \times 10^{3}', - 'fL': '1234.57 \pm 0.10', - 'FL': '1234.57 \pm 0.10', - 'fL': '1234.57 \pm 0.10', - 'FL': '1234.57 \pm 0.10', + 'fL': r'1234.57 \pm 0.10', + 'FL': r'1234.57 \pm 0.10', + 'fL': r'1234.57 \pm 0.10', + 'FL': r'1234.57 \pm 0.10', '%L': r'\left(123457 \pm 10\right) \%' }, # @@ -1747,7 +1747,7 @@ def test_format(): '15GS': ' -1.2(%s)E-12' % NaN_EFG, 'SL': r'-1.2(\mathrm{nan}) \times 10^{-12}', # LaTeX NaN # Pretty-print priority, but not for NaN: - 'PSL': u'-1.2(\mathrm{nan})×10⁻¹²', + 'PSL': r'-1.2(\mathrm{nan})×10⁻¹²', 'L': r'\left(-1.2 \pm \mathrm{nan}\right) \times 10^{-12}', # Uppercase NaN and LaTeX: '.1EL': (r'\left(-1.2 \pm \mathrm{%s}\right) \times 10^{-12}' @@ -1826,8 +1826,8 @@ def test_format(): # Default precision = 6 'eL': r'\left(1.234568 \pm 0\right) \times 10^{3}', 'EL': r'\left(1.234568 \pm 0\right) \times 10^{3}', - 'fL': '1234.567890 \pm 0', - 'FL': '1234.567890 \pm 0', + 'fL': r'1234.567890 \pm 0', + 'FL': r'1234.567890 \pm 0', '%L': r'\left(123456.789000 \pm 0\right) \%' }, @@ -1992,9 +1992,9 @@ def test_format(): # options: (float('-inf'), float('inf')): { 'S': '-inf(inf)', - 'LS': '-\infty(\infty)', - 'L': '-\infty \pm \infty', - 'LP': u'-\infty±\infty', + 'LS': r'-\infty(\infty)', + 'L': r'-\infty \pm \infty', + 'LP': r'-\infty±\infty', # The following is consistent with Python's own # formatting, which depends on the version of Python: # formatting float("-inf") with format(..., "020") gives @@ -2018,9 +2018,9 @@ def test_format(): }, (-float('nan'), float('inf')): { 'S': 'nan(inf)', - 'LS': '\mathrm{nan}(\infty)', - 'L': '\mathrm{nan} \pm \infty', - 'LP': u'\mathrm{nan}±\infty' + 'LS': r'\mathrm{nan}(\infty)', + 'L': r'\mathrm{nan} \pm \infty', + 'LP': r'\mathrm{nan}±\infty' }, # Leading zeroes in the shorthand notation: @@ -2140,7 +2140,7 @@ def test_custom_pretty_print_and_latex(): PREV_CUSTOMIZATIONS = { var: getattr(uncert_core, var).copy() for var in ['PM_SYMBOLS', 'MULT_SYMBOLS', 'GROUP_SYMBOLS']} - + # Customizations: for format in ["pretty-print", "latex"]: uncert_core.PM_SYMBOLS[format] = u" ± " @@ -2196,7 +2196,7 @@ def arrays_close(m1, m2, precision=1e-4): if not numbers_close(elmt1.std_dev, elmt2.std_dev, precision): return False - + return True @@ -2350,10 +2350,10 @@ def test_correlated_values(): for (variable, nom_value, variance) in zip( variables, nom_values, cov.diagonal()): - + assert numbers_close(variable.n, nom_value) - assert numbers_close(variable.s**2, variance) - + assert numbers_close(variable.s**2, variance) + assert arrays_close( cov, numpy.array(uncert_core.covariance_matrix(variables)))