Beispiel #1
0
    def test_memoized(self):
        u = URL('http://www.w3af.com/')
        self.assertEqual(u._cache, dict())

        domain_path = u.get_domain_path()
        self.assertNotEqual(u._cache, dict())
        self.assertIn(domain_path, u._cache.values())

        second_domain_path = u.get_domain_path()
        self.assertIs(domain_path, second_domain_path)

        self.assertIsInstance(domain_path, URL)
        self.assertIsInstance(second_domain_path, URL)
Beispiel #2
0
    def test_memoized(self):
        u = URL('http://www.w3af.com/')
        self.assertEqual(u._cache, dict())

        domain_path = u.get_domain_path()
        self.assertNotEqual(u._cache, dict())
        self.assertIn(domain_path, u._cache.values())

        second_domain_path = u.get_domain_path()
        self.assertIs(domain_path, second_domain_path)

        self.assertIsInstance(domain_path, URL)
        self.assertIsInstance(second_domain_path, URL)
Beispiel #3
0
    def test_can_be_pickled(self):
        # Pickle a URL object that contains a cache
        u = URL('http://www.w3af.com/')
        domain_path = u.get_domain_path()

        cPickle.dumps(u)
        cPickle.dumps(domain_path)
Beispiel #4
0
    def test_can_be_pickled(self):
        # Pickle a URL object that contains a cache
        u = URL('http://www.w3af.com/')
        domain_path = u.get_domain_path()

        cPickle.dumps(u)
        cPickle.dumps(domain_path)