Esempio n. 1
0
 def test_invalid_name(self):
     language1 = Language(self.ruleset, 'English')
     self.assertRaises(IllegalArgumentError, Language, self.ruleset,
                       'English')
     language2 = Language(self.ruleset, 'German')
     self.assertRaises(IllegalArgumentError, setattr, language2, 'name',
                       'English')
     # Changing a name should make it possible for the old name to
     # be used by a different language.
     language2.name = 'French'
     language1.name = 'German'
     # A newly set name must also be unavalable to other languages.
     self.assertRaises(IllegalArgumentError, setattr, language2, 'name',
                       'German')
Esempio n. 2
0
 def test_name(self):
     language = Language(self.ruleset, 'English')
     self.assertEqual(language.name, 'English')
     language.name = 'German'
     self.assertEqual(language.name, 'German')