def test_inlinepush(self): gui = window() gui.init_window(variant_name='classical', random_pick=False, debug=True) self.assertEqual(pos, pos_computed)
def test_click(self): gui = window() gui.init_window(variant_name='classical', random_pick=False, debug=True) R = gui.theme['dimension']['marble_radius'] pos = 0 for pos, (x_bot_left, y_bot_left) in enumerate(gui.theme['coordinates']): # get the center of the circle x_c = x_bot_left + R y_c = y_bot_left + R # add some noise noise_x = R * random.random() noise_y = (R - noise_x) * random.random() x = x_c + noise_x y = y_c + noise_y # pos_computed = gui.is_marbles_clicked(x, y) self.assertEqual(pos, pos_computed)
def test_ordered_dictionary_interger_string_key_types(self): input = OrderedDict({"test": "a", 2: "b", 45: "c"}) self.assertEqual(window(input), [('test', 2), (2, 45), (45, None)])
def test_list_empty(self): input = [] self.assertEqual(window(input), [([], None)])
def test_dictionary(self): input = {1: "a", 2: "b", 3: "c"} self.assertEqual(window(input), [(1, 2), (2, 3), (3, None)])
def test_ordered_dictionary(self): input = OrderedDict({1: "a", 2: "b", 3: "c"}) self.assertEqual(window(input), [(1, 2), (2, 3), (3, None)])
def test_set(self): input = {1, 2, 3, 4} self.assertEqual(window(input), [(1, 2), (2, 3), (3, 4), (4, None)])
def test_list_multiple_items(self): input = [1, 2, 3, 4] self.assertEqual(window(input), [(1, 2), (2, 3), (3, 4), (4, None)])
def test_list_single_item(self): input = [1] self.assertEqual(window(input), [(1, None)])
def go(q): q.put("Going") p2 = window(q)