Example #1
0
 def test_blank_mdn_key(self):
     # https://developer.mozilla.org/en-US/docs/Web/API/MIDIConnectionEvent
     raw = "{{SpecName('', '#midiconnection')}}"
     ks = SpecName(raw=raw, args=['', '#midiconnection'], scope=self.scope)
     self.assertEqual(ks.mdn_key, '')
     self.assertEqual(ks.subpath, '#midiconnection')
     self.assertIsNone(ks.section_name, None)
     issue = ks._make_issue('specname_blank_key')
     self.assertEqual(ks.issues, [issue])
Example #2
0
 def test_blank_mdn_key(self):
     # https://developer.mozilla.org/en-US/docs/Web/API/MIDIConnectionEvent
     raw = "{{SpecName('', '#midiconnection')}}"
     ks = SpecName(raw=raw, args=['', '#midiconnection'], scope=self.scope)
     self.assertEqual(ks.mdn_key, '')
     self.assertEqual(ks.subpath, '#midiconnection')
     self.assertIsNone(ks.section_name, None)
     issue = ks._make_issue('specname_blank_key')
     self.assertEqual(ks.issues, [issue])
Example #3
0
 def test_no_args(self):
     raw = '{{SpecName}}'
     ks = SpecName(raw=raw, scope=self.scope)
     issue = ks._make_issue(
         'kumascript_wrong_args', min=1, max=3, count=0,
         arg_names=['SpecKey', 'Anchor', 'AnchorName'],
         arg_count='0 arguments',
         arg_spec=(
             'between 1 and 3 arguments (SpecKey, Anchor, [AnchorName])'))
     self.assertEqual(ks.issues, [issue])
Example #4
0
 def test_no_args(self):
     raw = "{{SpecName}}"
     ks = SpecName(raw=raw, scope=self.scope)
     issue = ks._make_issue(
         'kumascript_wrong_args', min=1, max=3, count=0,
         arg_names=['SpecKey', 'Anchor', 'AnchorName'],
         arg_count='0 arguments',
         arg_spec=(
             'between 1 and 3 arguments (SpecKey, Anchor, [AnchorName])'))
     self.assertEqual(ks.issues, [issue])
Example #5
0
 def test_unknown_spec(self):
     raw = "{{SpecName('CSS3 Backgrounds')}}"
     ks = SpecName(raw=raw, args=['CSS3 Backgrounds'], scope=self.scope)
     self.assertEqual(ks.mdn_key, 'CSS3 Backgrounds')
     self.assertEqual(ks.subpath, None)
     self.assertEqual(ks.section_name, None)
     expected = [('unknown_spec', 0, 32, {'key': u'CSS3 Backgrounds'})]
     self.assertEqual(ks.issues, expected)
Example #6
0
 def test_1arg(self):
     self.get_instance('Specification', 'css3_backgrounds')
     raw = "{{SpecName('CSS3 Backgrounds')}}"
     ks = SpecName(raw=raw, args=['CSS3 Backgrounds'], scope=self.scope)
     self.assertEqual(ks.mdn_key, 'CSS3 Backgrounds')
     self.assertEqual(ks.subpath, None)
     self.assertEqual(ks.section_name, None)
     self.assertFalse(ks.issues)
Example #7
0
 def test_3args(self):
     self.get_instance('Specification', 'css3_backgrounds')
     raw = ('{{SpecName("CSS3 Backgrounds", "#the-background-size",'
            ' "background-size")}}')
     args = ['CSS3 Backgrounds', '#the-background-size', 'background-size']
     ks = SpecName(raw=raw, args=args, scope=self.scope)
     self.assertEqual(ks.mdn_key, 'CSS3 Backgrounds')
     self.assertEqual(ks.subpath, '#the-background-size')
     self.assertEqual(ks.section_name, 'background-size')
     self.assertFalse(ks.issues)
     self.assertEqual(text_type(ks), raw)