示例#1
0
 def testBasic (self):
     self.assertRaises(pyxb.SimpleTypeValueError, xsd.gMonth, 0)
     self.assertRaises(pyxb.SimpleTypeValueError, xsd.gMonth, 13)
     v = xsd.gMonth('--10')
     self.assertEqual(v.month, 10)
     v = xsd.gMonth(10)
     self.assertEqual(v.month, 10)
示例#2
0
 def testBasic(self):
     self.assertRaises(pyxb.SimpleTypeValueError, xsd.gMonth, 0)
     self.assertRaises(pyxb.SimpleTypeValueError, xsd.gMonth, 13)
     v = xsd.gMonth('--10')
     self.assertEqual(v.month, 10)
     v = xsd.gMonth(10)
     self.assertEqual(v.month, 10)
示例#3
0
    def testTimezoned (self):
        dt = xsd.gMonth('--08Z')
        self.assertEqual('1900-08-01T00:00:00+00:00', dt.isoformat())
        self.assertEqual('--08Z', dt.xsdLiteral())

        dt = xsd.gMonth('--08-14:00')
        self.assertEqual('1900-08-01T00:00:00-14:00', dt.isoformat())
        self.assertEqual('--08-14:00', dt.xsdLiteral())

        dt = xsd.gMonth('--08+14:00')
        self.assertEqual('1900-08-01T00:00:00+14:00', dt.isoformat())
        self.assertEqual('--08+14:00', dt.xsdLiteral())
示例#4
0
    def testTimezoned(self):
        dt = xsd.gMonth('--08Z')
        self.assertEqual('1900-08-01T00:00:00+00:00', dt.isoformat())
        self.assertEqual('--08Z', dt.xsdLiteral())

        dt = xsd.gMonth('--08-14:00')
        self.assertEqual('1900-08-01T00:00:00-14:00', dt.isoformat())
        self.assertEqual('--08-14:00', dt.xsdLiteral())

        dt = xsd.gMonth('--08+14:00')
        self.assertEqual('1900-08-01T00:00:00+14:00', dt.isoformat())
        self.assertEqual('--08+14:00', dt.xsdLiteral())
示例#5
0
 def XtestAccessor (self):
     v = xsd.gMonth(10)
     self.assertRaises((AttributeError, TypeError), getattr, v, 'year')
     #self.assertRaises((AttributeError, TypeError), getattr, v, 'month')
     self.assertRaises((AttributeError, TypeError), getattr, v, 'day')
     self.assertRaises((AttributeError, TypeError), setattr, v, 'year', 5)
     self.assertRaises((AttributeError, TypeError), setattr, v, 'month', 5)
     self.assertRaises((AttributeError, TypeError), setattr, v, 'day', 5)
示例#6
0
 def XtestAccessor(self):
     v = xsd.gMonth(10)
     self.assertRaises((AttributeError, TypeError), getattr, v, 'year')
     #self.assertRaises((AttributeError, TypeError), getattr, v, 'month')
     self.assertRaises((AttributeError, TypeError), getattr, v, 'day')
     self.assertRaises((AttributeError, TypeError), setattr, v, 'year', 5)
     self.assertRaises((AttributeError, TypeError), setattr, v, 'month', 5)
     self.assertRaises((AttributeError, TypeError), setattr, v, 'day', 5)
示例#7
0
 def testXSDLiteral (self):
     v = xsd.gMonth(10)
     self.assertEqual('--10', v.xsdLiteral())
示例#8
0
 def testXSDLiteral(self):
     v = xsd.gMonth(10)
     self.assertEqual('--10', v.xsdLiteral())