コード例 #1
0
              'RASH BUSH MILK LOOK BAD BRIM AVID GAFF BAIT ROT POD LOVE'),
             ('EFF81F9BFBC65350920CDD7416DE8009',
              'TROD MUTE TAIL WARM CHAR KONG HAAG CITY BORE O TEAL AWL')]


class RFC1751Test(TestScenario):
    def setup(self):
        pass

    def shutdown(self):
        pass

    def check_k2e(self):
        "Check converting keys to English"
        for key, words in test_data:
            key = binascii.a2b_hex(key)
            self.test_val('RFC1751.key_to_english(key)', words)

    def check_e2k(self):
        "Check converting English strings to keys"
        for key, words in test_data:
            key = binascii.a2b_hex(key)
            self.test_val('RFC1751.english_to_key(words)', key)


# class RFC1751Test

if __name__ == "__main__":
    (scenarios, options) = parse_args()
    run_scenarios(scenarios, options)
コード例 #2
0
the q\r
5\r
uick \r
5\r
brown\r
4\r
 fox\r
0\r
FOOTER\r
\r\n""")

    def check_compressed (self):
        p1 = producers.simple_producer(test_string, buffer_size = 5)
        p = producers.compressed_producer(p1)
        compr_data = self._check_all(p, zlib.compress(test_string, 5))
        self.test_val('zlib.decompress(compr_data)', test_string)

    def check_escaping (self):
        p1 = producers.simple_producer('the quick brown fox', buffer_size = 5)
        p = producers.escaping_producer(p1,
                                        esc_from = ' ',
                                        esc_to = '_')
        self._check_all(p, 'the_quick_brown_fox')
        
# class ProducerTest


if __name__ == "__main__":
    (scenarios, options) = parse_args()
    run_scenarios(scenarios, options)