def testParseSerialize(self): scheme = "pq://" for x in iri_samples: px = pg_iri.parse(x) spx = pg_iri.serialize(px) pspx = pg_iri.parse(spx) self.failUnless( pspx == px, "parse-serialize incongruity, %r -> %r -> %r : %r != %r" % (x, px, spx, pspx, px) ) spspx = pg_iri.serialize(pspx) self.failUnless( spx == spspx, "parse-serialize incongruity, %r -> %r -> %r -> %r : %r != %r" % (x, px, spx, pspx, spspx, spx), )
def testParseSerialize(self): scheme = 'pq://' for x in iri_samples: px = pg_iri.parse(x) spx = pg_iri.serialize(px) pspx = pg_iri.parse(spx) self.assertTrue( pspx == px, "parse-serialize incongruity, %r -> %r -> %r : %r != %r" % (x, px, spx, pspx, px)) spspx = pg_iri.serialize(pspx) self.assertTrue( spx == spspx, "parse-serialize incongruity, %r -> %r -> %r -> %r : %r != %r" % (x, px, spx, pspx, spspx, spx))
def testPresentPasswordObscure(self): "password is *not* present in IRI, and do nothing" s = 'pq://user@host:port/dbname' o = 'pq://user@host:port/dbname' p = pg_iri.parse(s) ps = pg_iri.serialize(p, obscure_password=True) self.assertEqual(ps, o)
def testPresentPasswordObscure(self): "password is present in IRI, and obscure it" s = 'pq://*****:*****@host:port/dbname' o = 'pq://*****:*****@host:port/dbname' p = pg_iri.parse(s) ps = pg_iri.serialize(p, obscure_password=True) self.assertEqual(ps, o)
def testPresentPasswordObscure(self): "password is *not* present in IRI, and do nothing" s = "pq://user@host:port/dbname" o = "pq://user@host:port/dbname" p = pg_iri.parse(s) ps = pg_iri.serialize(p, obscure_password=True) self.failUnlessEqual(ps, o)
def testPresentPasswordObscure(self): "password is present in IRI, and obscure it" s = "pq://*****:*****@host:port/dbname" o = "pq://*****:*****@host:port/dbname" p = pg_iri.parse(s) ps = pg_iri.serialize(p, obscure_password=True) self.failUnlessEqual(ps, o)
def testSerializeParse(self): for x in sample_structured_parameters: xs = pg_iri.serialize(x) uxs = pg_iri.parse(xs) self.assertTrue( x == uxs, "serialize-parse incongruity, %r -> %r -> %r" % ( x, xs, uxs, ))
def testSerializeParse(self): for x in sample_structured_parameters: xs = pg_iri.serialize(x) uxs = pg_iri.parse(xs) self.assertTrue( x == uxs, "serialize-parse incongruity, %r -> %r -> %r" %( x, xs, uxs, ) )
def testParseSerialize(self): scheme = 'pq://' for x in iri_samples: px = pg_iri.parse(x) spx = pg_iri.serialize(px) pspx = pg_iri.parse(spx) self.assertTrue( pspx == px, "parse-serialize incongruity, %r -> %r -> %r : %r != %r" %( x, px, spx, pspx, px ) ) spspx = pg_iri.serialize(pspx) self.assertTrue( spx == spspx, "parse-serialize incongruity, %r -> %r -> %r -> %r : %r != %r" %( x, px, spx, pspx, spspx, spx ) )