Esempio n. 1
0
 def test_str_repr(self):
     variable = writer.Variable("other_name", 15)
     variable.value = 12
     self.assertEqual(str(variable), "Variable('other_name', 15, 12)")
Esempio n. 2
0
 def test_tree_str_dict(self):
     variable = writer.Variable("other_name", 15)
     variable.value = {}
     self.assertEqual(variable.tree_str(), "other_name: dict = {}")
Esempio n. 3
0
 def test_tree_str_type_dict(self):
     variable = writer.Variable("other_name", 15)
     variable.value = dict
     self.assertEqual(variable.tree_str(),
                      "other_name: type = <class 'dict'>")
Esempio n. 4
0
 def test_set_value_int(self):
     variable = writer.Variable("other_name", 15)
     variable.value = 42
     self.assertEqual(variable.value, 42)
Esempio n. 5
0
 def test_tree_str_value_none(self):
     variable = writer.Variable("other_name", 15)
     variable.value = None
     self.assertEqual(variable.tree_str(), "other_name = None")
Esempio n. 6
0
 def test_set_value_string(self):
     variable = writer.Variable("other_name", 15)
     variable.value = "Hello World"
     self.assertEqual(variable.tree_str(),
                      "other_name: str = 'Hello World'")
Esempio n. 7
0
 def test_init_variable(self):
     variable = writer.Variable("some_name", 4)
     self.assertEqual(variable.name, "some_name")
     self.assertEqual(variable.col_offset, 4)
     self.assertIsNone(variable.value)
Esempio n. 8
0
 def test_type_name_type_dict(self):
     variable = writer.Variable("other_name", 15)
     variable.value = dict
     self.assertEqual(variable.type_name, "type")
Esempio n. 9
0
 def test_type_name_value_none(self):
     variable = writer.Variable("other_name", 15)
     variable.value = None
     self.assertEqual(variable.type_name, "NoneType")
Esempio n. 10
0
 def test_set_value_string(self):
     variable = writer.Variable("other_name", 15)
     variable.value = "Hello World"
     self.assertEqual(variable.value, '"Hello World"')