class TestStaticField(unittest.TestCase): def setUp(self): self.sf = StaticField("staticfield", 2) def test_trivial(self): pass def test_parse(self): self.assertEqual(self.sf.parse(six.b("ab")), six.b("ab")) def test_build(self): self.assertEqual(self.sf.build(six.b("ab")), six.b("ab")) def test_parse_too_short(self): self.assertRaises(FieldError, self.sf.parse, six.b("a")) def test_build_too_short(self): self.assertRaises(FieldError, self.sf.build, six.b("a")) def test_sizeof(self): self.assertEqual(self.sf.sizeof(), 2) def test_field_parse(self): f = Field('name', 6) self.assertEqual(f.parse(six.b('abcdef')), six.b('abcdef')) self.assertEqual(f.parse(six.b('12abcdef')), six.b('12abcd'))
class TestStaticField(unittest.TestCase): def setUp(self): self.sf = StaticField("staticfield", 2) def test_trivial(self): pass def test_parse(self): self.assertEqual(self.sf.parse(b"ab"), b"ab") def test_build(self): self.assertEqual(self.sf.build(b"ab"), b"ab") def test_parse_too_short(self): self.assertRaises(FieldError, self.sf.parse, b"a") def test_build_too_short(self): self.assertRaises(FieldError, self.sf.build, b"a") def test_sizeof(self): self.assertEqual(self.sf.sizeof(), 2) def test_field_parse(self): f = Field("name", 6) self.assertEqual(f.parse(b"abcdef"), b"abcdef") self.assertEqual(f.parse(b"12abcdef"), b"12abcd")
class TestStaticField(unittest.TestCase): def setUp(self): self.sf = StaticField("staticfield", 2) def test_trivial(self): pass def test_parse(self): self.assertEqual(self.sf.parse(b"ab"), b"ab") def test_build(self): self.assertEqual(self.sf.build(b"ab"), b"ab") def test_parse_too_short(self): self.assertRaises(FieldError, self.sf.parse, b"a") def test_build_too_short(self): self.assertRaises(FieldError, self.sf.build, b"a") def test_sizeof(self): self.assertEqual(self.sf.sizeof(), 2) def test_field_parse(self): f = Field('name', 6) self.assertEqual(f.parse(b'abcdef'), b'abcdef') self.assertEqual(f.parse(b'12abcdef'), b'12abcd')
class TestStaticField(unittest.TestCase): def setUp(self): self.sf = StaticField("staticfield", 2) def test_trivial(self): pass def test_parse(self): self.assertEqual(self.sf.parse("ab"), "ab") def test_build(self): self.assertEqual(self.sf.build("ab"), "ab") def test_parse_too_short(self): self.assertRaises(FieldError, self.sf.parse, "a") def test_build_too_short(self): self.assertRaises(FieldError, self.sf.build, "a") def test_sizeof(self): self.assertEqual(self.sf.sizeof(), 2)