@@ -140,5 +140,49 @@ def test_Spaces(self):
140140 finally :
141141 self .deleteStream (key )
142142
143+ def test_ReadFromSpaces (self ):
144+ key = 'BarsWithSpaces'
145+ try :
146+ stream = self .createStream (key )
147+ self .assertIsNotNone (stream )
148+
149+ count = 1234
150+ testutils .loadBars (stream , count , 0 , 1000000000 , ['MSFT' , 'ORCL' ])
151+ testutils .loadBars (stream , count , 0 , 1000000000 , ['SX' ], 'SpaceX' )
152+ testutils .loadBars (stream , count , 0 , 1000000000 , ['SY' ], 'SpaceY' )
153+
154+ time .sleep (1 )
155+
156+ so = tbapi .SelectionOptions ()
157+ with stream .trySelect (0 , so , None , None ) as cursor :
158+ self .checkCursorSymbols (cursor , set (['MSFT' , 'ORCL' , 'SX' , 'SY' ]))
159+
160+ so = tbapi .SelectionOptions ()
161+ so .withSpaces (['SpaceX' ])
162+ with stream .trySelect (0 , so , None , None ) as cursor :
163+ self .checkCursorSymbols (cursor , set (['SX' ]))
164+
165+ so = tbapi .SelectionOptions ()
166+ so .withSpaces (['SpaceY' ])
167+ with stream .trySelect (0 , so , None , None ) as cursor :
168+ self .checkCursorSymbols (cursor , set (['SY' ]))
169+
170+ so = tbapi .SelectionOptions ()
171+ so .withSpaces (['SpaceY' , 'SpaceX' ])
172+ with stream .trySelect (0 , so , None , None ) as cursor :
173+ self .checkCursorSymbols (cursor , set (['SY' , 'SX' ]))
174+
175+ so = tbapi .SelectionOptions ()
176+ so .withSpaces (['' ])
177+ with stream .trySelect (0 , so , None , None ) as cursor :
178+ self .checkCursorSymbols (cursor , set (['MSFT' , 'ORCL' ]))
179+
180+ so = tbapi .SelectionOptions ()
181+ so .withSpaces (None )
182+ with stream .trySelect (0 , so , None , None ) as cursor :
183+ self .checkCursorSymbols (cursor , set (['MSFT' , 'ORCL' , 'SX' , 'SY' ]))
184+ finally :
185+ self .deleteStream (key )
186+
143187if __name__ == '__main__' :
144188 unittest .main ()
0 commit comments