コード例 #1
0
ファイル: test_msg.py プロジェクト: learnpython/advanced-01
 def test_load(self):
     s = String()
     s.name = 'x'
     o = Object()
     buf = b'\x00\x00\x00\x02ef'
     self.assertEqual(6, s.load(o, buf))
     self.assertEqual('ef', o.x)
コード例 #2
0
ファイル: test_msg.py プロジェクト: learnpython/advanced-01
 def test_store(self):
     s = String()
     s.name = 'x'
     o = Object()
     o.x = 'abc'
     buf = s.store(o)
     self.assertEqual(b'\x00\x00\x00\x03abc', buf)
コード例 #3
0
ファイル: test_msg.py プロジェクト: shilow/advanced-01
 def test_load(self):
     s = String()
     s.name = 'x'
     o = Object()
     buf = b'\x00\x00\x00\x02ef'
     self.assertEqual(6, s.load(o, buf))
     self.assertEqual('ef', o.x)
コード例 #4
0
ファイル: test_msg.py プロジェクト: shilow/advanced-01
 def test_store(self):
     s = String()
     s.name = 'x'
     o = Object()
     o.x = 'abc'
     buf = s.store(o)
     self.assertEqual(b'\x00\x00\x00\x03abc', buf)
コード例 #5
0
ファイル: test_msg.py プロジェクト: learnpython/advanced-01
 def test_type(self):
     s = String()
     s.name = 'x'
     with self.assertRaises(TypeError):
         s.type_check(123)
コード例 #6
0
ファイル: test_msg.py プロジェクト: shilow/advanced-01
 def test_type(self):
     s = String()
     s.name = 'x'
     with self.assertRaises(TypeError):
         s.type_check(123)