| 338 | |
| 339 | |
| 340 | def test_url(): |
| 341 | # Test that object url appears in output svg. |
| 342 | |
| 343 | fig, ax = plt.subplots() |
| 344 | |
| 345 | # collections |
| 346 | s = ax.scatter([1, 2, 3], [4, 5, 6]) |
| 347 | s.set_urls(['https://example.com/foo', 'https://example.com/bar', None]) |
| 348 | |
| 349 | # Line2D |
| 350 | p, = plt.plot([2, 3, 4], [4, 5, 6]) |
| 351 | p.set_url('https://example.com/baz') |
| 352 | |
| 353 | # Line2D markers-only |
| 354 | p, = plt.plot([3, 4, 5], [4, 5, 6], linestyle='none', marker='x') |
| 355 | p.set_url('https://example.com/quux') |
| 356 | |
| 357 | b = BytesIO() |
| 358 | fig.savefig(b, format='svg') |
| 359 | b = b.getvalue() |
| 360 | for v in [b'foo', b'bar', b'baz', b'quux']: |
| 361 | assert b'https://example.com/' + v in b |
| 362 | |
| 363 | |
| 364 | def test_url_tick(monkeypatch): |