def test_create_variable_set_float(self): variable_set = VarSet(ZOE, value=42) expected = ('<text:variable-set text:name="%s" ' 'office:value-type="float" calcext:value-type="float" ' 'office:value="42" calcext:value="42" ' 'text:display="none"/>') % ZOE self.assertEqual(variable_set.serialize(), expected)
def test_with_variable(self): variable_set = VarSet(ZOE, 42) set_value(variable_set, ZOE) expected = ('<text:variable-set office:value-type="string" ' 'office:string-value="%s" text:name="%s" ' 'text:display="none">' '%s' '</text:variable-set>') % (ZOE, ZOE, ZOE) self.assertEqual(variable_set.serialize(), expected)
def test_create_variable_set_datetime(self): date = datetime(2009, 5, 17, 23, 23, 00) variable_set = VarSet(ZOE, value=date, display=True) expected = ('<text:variable-set text:name="%s" ' 'office:value-type="date" ' 'office:date-value="2009-05-17T23:23:00">' '2009-05-17T23:23:00' '</text:variable-set>') % ZOE self.assertEqual(variable_set.serialize(), expected)
def test_with_variable(self): variable_set = VarSet(ZOE, 42) self.assertEqual(get_value(variable_set), 42)