mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
100% unit test coverage
This commit is contained in:
parent
763e1ff786
commit
eba485f5eb
@ -84,7 +84,7 @@ def write_values(fp, vals, actions, sofar=0, skip=0, blocksize=BLOCKSIZE):
|
|||||||
send_chunk(fp, a[2], blocksize, 0, len(a[2]))
|
send_chunk(fp, a[2], blocksize, 0, len(a[2]))
|
||||||
send_chunk(fp, v, blocksize, offset, len(v))
|
send_chunk(fp, v, blocksize, offset, len(v))
|
||||||
sofar += len(v)
|
sofar += len(v)
|
||||||
except tcp.NetLibDisconnect:
|
except tcp.NetLibDisconnect: # pragma: no cover
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ class _Value:
|
|||||||
def get_generator(self, settings):
|
def get_generator(self, settings):
|
||||||
return LiteralGenerator(self.val)
|
return LiteralGenerator(self.val)
|
||||||
|
|
||||||
def __str__(self):
|
def __repr__(self):
|
||||||
return self.val
|
return self.val
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ class TestMisc:
|
|||||||
assert g[0] == "x"
|
assert g[0] == "x"
|
||||||
assert g[-1] == "x"
|
assert g[-1] == "x"
|
||||||
assert g[0:5] == "xxxxx"
|
assert g[0:5] == "xxxxx"
|
||||||
|
assert repr(g)
|
||||||
|
|
||||||
def test_valueliteral(self):
|
def test_valueliteral(self):
|
||||||
v = rparse.ValueLiteral("foo")
|
v = rparse.ValueLiteral("foo")
|
||||||
@ -47,10 +48,12 @@ class TestMisc:
|
|||||||
v = rparse.ValueLiteral(r"foo\n")
|
v = rparse.ValueLiteral(r"foo\n")
|
||||||
assert v.expr()
|
assert v.expr()
|
||||||
assert v.val == "foo\n"
|
assert v.val == "foo\n"
|
||||||
|
assert repr(v)
|
||||||
|
|
||||||
def test_valuenakedliteral(self):
|
def test_valuenakedliteral(self):
|
||||||
v = rparse.ValueNakedLiteral("foo")
|
v = rparse.ValueNakedLiteral("foo")
|
||||||
assert v.expr()
|
assert v.expr()
|
||||||
|
assert repr(v)
|
||||||
|
|
||||||
def test_file_value(self):
|
def test_file_value(self):
|
||||||
v = rparse.Value.parseString("<'one two'")[0]
|
v = rparse.Value.parseString("<'one two'")[0]
|
||||||
@ -104,6 +107,8 @@ class TestMisc:
|
|||||||
def test_path(self):
|
def test_path(self):
|
||||||
e = rparse.Path.expr()
|
e = rparse.Path.expr()
|
||||||
assert e.parseString('"/foo"')[0].value.val == "/foo"
|
assert e.parseString('"/foo"')[0].value.val == "/foo"
|
||||||
|
e = rparse.Path("/foo")
|
||||||
|
assert e.value.val == "/foo"
|
||||||
|
|
||||||
def test_method(self):
|
def test_method(self):
|
||||||
e = rparse.Method.expr()
|
e = rparse.Method.expr()
|
||||||
|
Loading…
Reference in New Issue
Block a user