def test_latex_format(self): fl = AngleFormatterLocator(number=5, format="dd:mm:ss") assert fl.formatter([15.392231] * u.degree, None)[0] == '15\xb023\'32"' with rc_context(rc={'text.usetex': True}): assert fl.formatter( [15.392231] * u.degree, None)[0] == "$15^\\circ23{}^\\prime32{}^{\\prime\\prime}$"
def test_formatter_no_format_with_units(self, format_unit, decimal, show_decimal_unit, spacing, ascii, latex): # Check the formatter works when specifying the default units and # decimal behavior to use. fl = AngleFormatterLocator(unit=u.degree, format_unit=format_unit, decimal=decimal, show_decimal_unit=show_decimal_unit) assert fl.formatter([15.392231] * u.degree, spacing, format='ascii')[0] == ascii assert fl.formatter([15.392231] * u.degree, spacing, format='latex')[0] == latex
def test_formatter_no_format(self, spacing, string): fl = AngleFormatterLocator() assert fl.formatter([15.392231] * u.degree, spacing)[0] == string
def test_format(self, format, string): fl = AngleFormatterLocator(number=5, format=format) assert fl.formatter([15.392231] * u.degree, None, format='ascii')[0] == string
def test_separator(self, separator, format, string): fl = AngleFormatterLocator(number=5, format=format) fl.sep = separator assert fl.formatter([15.392231] * u.degree, None)[0] == string
def test_formatter_no_format_with_units(self, format_unit, decimal, show_decimal_unit, spacing, ascii, latex): # Check the formatter works when specifying the default units and # decimal behavior to use. fl = AngleFormatterLocator(unit=u.degree, format_unit=format_unit, decimal=decimal, show_decimal_unit=show_decimal_unit) assert fl.formatter([15.392231] * u.degree, spacing, format='ascii')[0] == ascii assert fl.formatter([15.392231] * u.degree, spacing, format='latex')[0] == latex
def test_formatter_no_format(self, spacing, string): fl = AngleFormatterLocator() assert fl.formatter([15.392231] * u.degree, spacing)[0] == string
def test_latex_format(self): fl = AngleFormatterLocator(number=5, format="dd:mm:ss") assert fl.formatter([15.392231] * u.degree, None)[0] == '15\xb023\'32"' with rc_context(rc={'text.usetex': True}): assert fl.formatter([15.392231] * u.degree, None)[0] == "$15^\\circ23{}^\\prime32{}^{\\prime\\prime}$"
def test_separator(self, separator, format, string): fl = AngleFormatterLocator(number=5, format=format) fl.sep = separator assert fl.formatter([15.392231] * u.degree, None)[0] == string
def test_format(self, format, string): fl = AngleFormatterLocator(number=5, format=format) print(fl.formatter([15.392231] * u.degree, None, format='ascii')[0], string) assert fl.formatter([15.392231] * u.degree, None, format='ascii')[0] == string