(self)
| 1359 | self.assertEqual(self.spin.get(), '1') |
| 1360 | |
| 1361 | def test_configure_values(self): |
| 1362 | self.assertEqual(self.spin['values'], '') |
| 1363 | self.checkParam(self.spin, 'values', 'mon tue wed thur', |
| 1364 | expected=('mon', 'tue', 'wed', 'thur')) |
| 1365 | self.checkParam(self.spin, 'values', ('mon', 'tue', 'wed', 'thur')) |
| 1366 | self.checkParam(self.spin, 'values', (42, 3.14, '', 'any string')) |
| 1367 | self.checkParam(self.spin, 'values', '') |
| 1368 | |
| 1369 | self.spin['values'] = ['a', 1, 'c'] |
| 1370 | |
| 1371 | # test incrementing / decrementing values |
| 1372 | self.spin.set('a') |
| 1373 | self.spin.update() |
| 1374 | self._click_increment_arrow() |
| 1375 | self.assertEqual(self.spin.get(), '1') |
| 1376 | |
| 1377 | self._click_decrement_arrow() |
| 1378 | self.assertEqual(self.spin.get(), 'a') |
| 1379 | |
| 1380 | # testing values with empty string set through configure |
| 1381 | self.spin.configure(values=[1, '', 2]) |
| 1382 | self.assertEqual(self.spin['values'], |
| 1383 | ('1', '', '2') if self.wantobjects else |
| 1384 | '1 {} 2') |
| 1385 | |
| 1386 | # testing values with spaces |
| 1387 | self.spin['values'] = ['a b', 'a\tb', 'a\nb'] |
| 1388 | self.assertEqual(self.spin['values'], |
| 1389 | ('a b', 'a\tb', 'a\nb') if self.wantobjects else |
| 1390 | '{a b} {a\tb} {a\nb}') |
| 1391 | |
| 1392 | # testing values with special characters |
| 1393 | self.spin['values'] = [r'a\tb', '"a"', '} {'] |
| 1394 | self.assertEqual(self.spin['values'], |
| 1395 | (r'a\tb', '"a"', '} {') if self.wantobjects else |
| 1396 | r'a\\tb {"a"} \}\ \{') |
| 1397 | |
| 1398 | # testing creating spinbox with empty string in values |
| 1399 | spin2 = ttk.Spinbox(self.root, values=[1, 2, '']) |
| 1400 | self.assertEqual(spin2['values'], |
| 1401 | ('1', '2', '') if self.wantobjects else '1 2 {}') |
| 1402 | spin2.destroy() |
| 1403 | |
| 1404 | |
| 1405 | @add_configure_tests(StandardTtkOptionsTests) |
nothing calls this directly
no test coverage detected