コード例 #1
0
ファイル: indexing_tests.py プロジェクト: npryce/deft
 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")
コード例 #2
0
ファイル: indexing_tests.py プロジェクト: npryce/deft
 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")
コード例 #3
0
ファイル: indexing_tests.py プロジェクト: npryce/deft
 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"))
コード例 #4
0
ファイル: indexing_tests.py プロジェクト: npryce/deft
 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))
コード例 #5
0
ファイル: indexing_tests.py プロジェクト: npryce/deft
 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")
コード例 #6
0
ファイル: indexing_tests.py プロジェクト: npryce/deft
 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")
コード例 #7
0
ファイル: indexing_tests.py プロジェクト: npryce/deft
 def test_can_remove_last_feature(self):
     index = PriorityIndex(["alice", "bob", "carol", "dave"])
     index.remove("dave")
     
     assert_feature_priorities(index, "alice", "bob", "carol")
コード例 #8
0
ファイル: indexing_tests.py プロジェクト: npryce/deft
 def test_can_rename_feature(self):
     index = PriorityIndex(["alice", "bob", "carol", "dave"])
     
     index.rename("bob", "robert")
     
     assert_feature_priorities(index, "alice", "robert", "carol", "dave")
コード例 #9
0
ファイル: indexing_tests.py プロジェクト: npryce/deft
 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")
コード例 #10
0
ファイル: indexing_tests.py プロジェクト: npryce/deft
 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")
コード例 #11
0
ファイル: indexing_tests.py プロジェクト: npryce/deft
 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")
コード例 #12
0
ファイル: indexing_tests.py プロジェクト: npryce/deft
 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")