예제 #1
0
 def test_unknownkey_raises(self):
     pd = ProxyData(version=1)
     pd.protocol = PROTO.UNSPEC
     assert pd.valid
     assert pd
     expectre = r"notfound:strange_key"
     with pytest.raises(KeyError, match=expectre):
         pd.same_attribs(_raises=True, strange_key="Unrecognized")
예제 #2
0
 def test_mismatch_raises(self):
     pd = ProxyData(version=1)
     pd.protocol = PROTO.UNSPEC
     assert pd.valid
     assert pd
     expectre = r"mismatch:protocol actual=.* expect=.*"
     with pytest.raises(ValueError, match=expectre):
         pd.same_attribs(_raises=True, protocol=PROTO.STREAM)
예제 #3
0
 def test_unknownkey(self):
     pd = ProxyData(version=1)
     pd.protocol = PROTO.UNSPEC
     assert pd.valid
     assert pd
     assert not pd.same_attribs(strange_key="Unrecognized")
예제 #4
0
 def test_unsetkey(self):
     pd = ProxyData(version=1)
     pd.protocol = PROTO.UNSPEC
     assert pd.valid
     assert pd
     assert not pd.same_attribs(src_addr="Missing")
예제 #5
0
 def test_mismatch(self):
     pd = ProxyData(version=1)
     pd.protocol = PROTO.UNSPEC
     assert pd.valid
     assert pd
     assert not pd.same_attribs(protocol=PROTO.STREAM)