Exemple #1
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']
Exemple #2
0
 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
Exemple #3
0
 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']
Exemple #4
0
 def test_attributes_remember_their_values(self):
     f = Form()
     f.y = 3
     f.x = 1
     f.z = 2
     assert f.x == 1
     assert f.y == 3
     assert f.z == 2
Exemple #5
0
 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']