()
| 1959 | |
| 1960 | @mpl.style.context('default') |
| 1961 | def test_loglocator_properties(): |
| 1962 | # Test that LogLocator returns ticks satisfying basic desirable properties |
| 1963 | # for a wide range of inputs. |
| 1964 | max_numticks = 8 |
| 1965 | pow_end = 20 |
| 1966 | for numticks, (lo, hi) in itertools.product( |
| 1967 | range(1, max_numticks + 1), itertools.combinations(range(pow_end), 2)): |
| 1968 | ll = mticker.LogLocator(numticks=numticks) |
| 1969 | decades = np.log10(ll.tick_values(10**lo, 10**hi)).round().astype(int) |
| 1970 | # There are no more ticks than the requested number, plus exactly one |
| 1971 | # tick below and one tick above the limits. |
| 1972 | assert len(decades) <= numticks + 2 |
| 1973 | assert decades[0] < lo <= decades[1] |
| 1974 | assert decades[-2] <= hi < decades[-1] |
| 1975 | stride, = {*np.diff(decades)} # Extract the (constant) stride. |
| 1976 | # Either the ticks are on integer multiples of the stride... |
| 1977 | if not (decades % stride == 0).all(): |
| 1978 | # ... or (for this given stride) no offset would be acceptable, |
| 1979 | # i.e. they would either result in fewer ticks than the selected |
| 1980 | # solution, or more than the requested number of ticks. |
| 1981 | for offset in range(0, stride): |
| 1982 | alt_decades = range(lo + offset, hi + 1, stride) |
| 1983 | assert len(alt_decades) < len(decades) or len(alt_decades) > numticks |
| 1984 | |
| 1985 | |
| 1986 | def test_NullFormatter(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…