Esempio n. 1
0
def test_build_spaced_ticks(unittest):
    from dtale.dash_application.charts import build_spaced_ticks

    ticks = list("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef")
    output = build_spaced_ticks(ticks)
    unittest.assertEqual({"tickmode": "auto", "nticks": 17}, output)
    output = build_spaced_ticks(ticks, mode="array")
    expected = {
        "tickmode":
        "array",
        "tickvals":
        [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 31],
        "ticktext": [
            "A",
            "C",
            "E",
            "G",
            "I",
            "K",
            "M",
            "O",
            "Q",
            "S",
            "U",
            "W",
            "Y",
            "a",
            "c",
            "e",
            "f",
        ],
    }
    unittest.assertEqual(expected, output)
Esempio n. 2
0
def test_build_spaced_ticks(unittest):
    from dtale.dash_application.charts import build_spaced_ticks

    ticks = list('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef')
    output = build_spaced_ticks(ticks)
    unittest.assertEqual({'tickmode': 'auto', 'nticks': 17}, output)
    output = build_spaced_ticks(ticks, mode='array')
    expected = {
        'tickmode':
        'array',
        'tickvals':
        [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 31],
        'ticktext': [
            'A', 'C', 'E', 'G', 'I', 'K', 'M', 'O', 'Q', 'S', 'U', 'W', 'Y',
            'a', 'c', 'e', 'f'
        ]
    }
    unittest.assertEqual(expected, output)
Esempio n. 3
0
def test_build_spaced_ticks(unittest):
    ticks = range(50)
    cfg = build_spaced_ticks(ticks)
    assert cfg['nticks'] == 26
Esempio n. 4
0
def test_build_spaced_ticks(unittest):
    ticks = range(50)
    cfg = build_spaced_ticks(ticks)
    assert len(cfg['tickvals']) == 26