<s> import numpy as np <EOL> from vispy . scene . visuals import Spectrogram <EOL> from vispy . testing import ( requires_application , TestingCanvas , <EOL> run_tests_if_main ) <EOL> from vispy . testing . image_tester import assert_image_approved <EOL> @ requires_application ( ) <EOL> def test_spectrogram ( ) : <EOL> """<STR_LIT>""" <EOL> n_fft = <NUM_LIT> <EOL> n_freqs = n_fft // <NUM_LIT:2> + <NUM_LIT:1> <EOL> size = ( <NUM_LIT:100> , n_freqs ) <EOL> with TestingCanvas ( size = size ) as c : <EOL> np . random . seed ( <NUM_LIT> ) <EOL> data = np . random . normal ( size = n_fft * <NUM_LIT:100> ) <EOL> spec = Spectrogram ( data , n_fft = n_fft , step = n_fft , window = None , <EOL> color_scale = '<STR_LIT>' , cmap = '<STR_LIT>' ) <EOL> c . draw_visual ( spec ) <EOL> assert_image_approved ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> freqs = spec . freqs <EOL> assert len ( freqs ) == n_freqs <EOL> assert freqs [ <NUM_LIT:0> ] == <NUM_LIT:0> <EOL> assert freqs [ - <NUM_LIT:1> ] == <NUM_LIT:0.5> <EOL> run_tests_if_main ( ) </s>
