コード例 #1
0
ファイル: expected_value.py プロジェクト: pahko/caliendo
    def test_purge(self):
 
      delete_from_directory_by_hashes(CACHE_DIRECTORY, '*')
      delete_from_directory_by_hashes(EV_DIRECTORY, '*')
      delete_from_directory_by_hashes(SEED_DIRECTORY, '*')

      all_hashes = read_all()
      assert len(all_hashes['evs']) == 0
      assert len(all_hashes['cache']) == 0
      assert len(all_hashes['seeds']) == 0

      with open(LOG_FILEPATH, 'w+') as fp:
          pass

      expected_value.is_equal_to(find_foo(1))
      expected_value.is_equal_to(find_biz(1))
      expected_value.is_equal_to(find_baz(1))
      expected_value.is_equal_to(find_bar(1))

      spam = read_all()
      assert len(spam['evs']) != 0
      assert len(spam['cache']) != 0
      assert len(spam['seeds']) != 0
      
      with open(LOG_FILEPATH, 'w+') as fp:
          pass

      expected_value.is_equal_to(find_foo(1))
      expected_value.is_equal_to(find_biz(1))
      expected_value.is_equal_to(find_baz(1))
      expected_value.is_equal_to(find_bar(1))

      spam_and_ham = read_all() 
      purge() 
      ham = read_all()

      for kind, hashes in ham.items():
          for h in hashes:
              assert h not in spam[kind]

      for kind, hashes in spam.items():
          for h in hashes:
              assert h not in ham[kind]

      for kind, hashes in spam_and_ham.items():
          for h in hashes:
              assert h in spam[kind] or h in ham[kind]
コード例 #2
0
ファイル: expected_value.py プロジェクト: pahko/caliendo
 def test_multiple_expected_value_calls(self):
     assert expected_value.is_equal_to(2)
     assert expected_value.is_equal_to(3)
     assert expected_value.is_equal_to(4)
コード例 #3
0
ファイル: expected_value.py プロジェクト: pahko/caliendo
 def test_expected_value_prompt(self):
     assert expected_value.is_equal_to(2) 
コード例 #4
0
ファイル: expected_value.py プロジェクト: mplacona/caliendo
    def test_purge(self):
 
      delete_from_directory_by_hashes('cache', '*')
      delete_from_directory_by_hashes('evs', '*')
      delete_from_directory_by_hashes('seeds', '*')

      all_hashes = read_all()
      assert len(all_hashes['evs']) == 0
      assert len(all_hashes['cache']) == 0
      assert len(all_hashes['seeds']) == 0

      with open(LOG_FILEPATH, 'w+') as fp:
          pass

      expected_value.is_equal_to(find_foo(1))
      expected_value.is_equal_to(find_biz(1))
      expected_value.is_equal_to(find_baz(1))
      expected_value.is_equal_to(find_bar(1))

      spam = read_all()
      assert len(spam['evs']) != 0
      assert len(spam['cache']) != 0
      assert len(spam['seeds']) != 0
      
      with open(LOG_FILEPATH, 'w+') as fp:
          pass

      expected_value.is_equal_to(find_foo(1))
      expected_value.is_equal_to(find_biz(1))
      expected_value.is_equal_to(find_baz(1))
      expected_value.is_equal_to(find_bar(1))

      spam_and_ham = read_all() 
      purge() 
      ham = read_all()

      for kind, hashes in ham.items():
          for h in hashes:
              assert h not in spam[kind]

      for kind, hashes in spam.items():
          for h in hashes:
              assert h not in ham[kind]

      for kind, hashes in spam_and_ham.items():
          for h in hashes:
              assert h in spam[kind] or h in ham[kind]
コード例 #5
0
ファイル: expected_value.py プロジェクト: mplacona/caliendo
 def test_multiple_expected_value_calls(self):
     assert expected_value.is_equal_to(2)
     assert expected_value.is_equal_to(3)
     assert expected_value.is_equal_to(4)
コード例 #6
0
ファイル: expected_value.py プロジェクト: mplacona/caliendo
 def test_expected_value_prompt(self):
     assert expected_value.is_equal_to(2)