Example #1
0
    def test__file_too_small(self):

        """
        Fail to hash empty and small files.

        Because the hash is undefined for files < 128 KiB.
        """

        with open(os.devnull, "rb") as file_:
            with self.assertRaises(Exception):
                opensub.hash_file(file_)
Example #2
0
    def test__hash_of_breakdance_avi(self):

        """Calculate proper hash via function interface."""

        with open(self.test_avi, "rb") as file_:
            hash_ = opensub.hash_file(file_)
        self.assertEqual(hash_, self.test_avi_correct_hash)