示例#1
0
文件: test_form.py 项目: B-Rich/luca
 def test_input_attributes_cannot_become_outputs(self):
     f = Form()
     f.y = 3
     f.x = 1
     f._enter_output_mode()
     f.z = 2
     with self.assertRaises(TypeError):
         f.x = 4
示例#2
0
文件: test_form.py 项目: B-Rich/luca
 def test_attributes_remember_their_order(self):
     f = Form()
     f.y = 3
     f.x = 1
     f._enter_output_mode()
     f.z = 2
     assert f._inputs == ['y', 'x']
     assert f._outputs == ['z']
示例#3
0
文件: test_form.py 项目: B-Rich/luca
 def test_default_attributes_disappear_from_output(self):
     f = Form()
     f.x = 1
     f._enter_default_mode()
     f.x = -1
     f.y = -2
     f._enter_output_mode()
     f.z = -3
     assert f._inputs == ['x']
     assert f._outputs == ['z']
示例#4
0
 def test_attributes_are_only_listed_once(self):
     f = Form()
     f.y = 3
     f.x = 1
     f._enter_output_mode()
     f.z = 2
     f.w = 4
     f.w = 8
     f.z = 1
     assert f._inputs == ['y', 'x']
     assert f._outputs == ['z', 'w']