Esempio n. 1
0
 def test_can_append_after_removing(self):
     index = PriorityIndex(["alice", "bob", "carol"])
     
     index.remove("bob")
     index.append("dave")
     
     assert_feature_priorities(index, "alice", "carol", "dave")
Esempio n. 2
0
 def test_can_append_features(self):
     index = PriorityIndex(["alice", "bob"])
     
     index.append("carol")
     assert_feature_priorities(index, "alice", "bob", "carol")
     
     index.append("dave")
     assert_feature_priorities(index, "alice", "bob", "carol", "dave")
Esempio n. 3
0
 def test_indexes_features_by_priority(self):
     index = PriorityIndex(["alice", "bob", "carol", "dave", "eve"])
     
     assert_that(index.feature_with_priority(1), equal_to("alice"))
     assert_that(index.feature_with_priority(2), equal_to("bob"))
     assert_that(index.feature_with_priority(3), equal_to("carol"))
     assert_that(index.feature_with_priority(4), equal_to("dave"))
     assert_that(index.feature_with_priority(5), equal_to("eve"))
Esempio n. 4
0
 def test_indexes_priorities_by_feature(self):
     index = PriorityIndex(["alice", "bob", "carol", "dave", "eve"])
     
     assert_that(index.priority_of_feature("alice"), equal_to(1))
     assert_that(index.priority_of_feature("bob"), equal_to(2))
     assert_that(index.priority_of_feature("carol"), equal_to(3))
     assert_that(index.priority_of_feature("dave"), equal_to(4))
     assert_that(index.priority_of_feature("eve"), equal_to(5))
Esempio n. 5
0
 def test_can_insert_features_in_middle(self):
     index = PriorityIndex(["alice", "bob", "carol"])
     
     index.insert("eve", 4)
     
     assert_feature_priorities(index, "alice", "bob", "carol", "eve")
Esempio n. 6
0
 def test_can_insert_features_at_front(self):
     index = PriorityIndex(["alice", "bob", "carol"])
     
     index.insert("eve", 1)
     
     assert_feature_priorities(index, "eve", "alice", "bob", "carol")
Esempio n. 7
0
 def test_can_remove_last_feature(self):
     index = PriorityIndex(["alice", "bob", "carol", "dave"])
     index.remove("dave")
     
     assert_feature_priorities(index, "alice", "bob", "carol")
Esempio n. 8
0
 def test_can_rename_feature(self):
     index = PriorityIndex(["alice", "bob", "carol", "dave"])
     
     index.rename("bob", "robert")
     
     assert_feature_priorities(index, "alice", "robert", "carol", "dave")
Esempio n. 9
0
 def test_moving_feature_to_same_priority_has_no_effect(self):
     index = PriorityIndex(["alice", "bob", "carol", "dave"])
     
     index.change_priority("bob", 2)
     
     assert_feature_priorities(index, "alice", "bob", "carol", "dave")
Esempio n. 10
0
 def test_can_move_feature_down_in_the_middle(self):
     index = PriorityIndex(["alice", "bob", "carol", "dave"])
     
     index.change_priority("bob", 3)
     
     assert_feature_priorities(index, "alice", "carol", "bob", "dave")
Esempio n. 11
0
 def test_can_move_feature_from_middle_to_bottom(self):
     index = PriorityIndex(["alice", "bob", "carol", "dave"])
     
     index.change_priority("bob", 4)
     
     assert_feature_priorities(index, "alice", "carol", "dave", "bob")
Esempio n. 12
0
 def test_limits_priorities_to_lowest_priority_on_insert(self):
     index = PriorityIndex(["alice", "bob", "carol"])
     
     index.insert("eve", 5)
     
     assert_feature_priorities(index, "alice", "bob", "carol", "eve")