示例#1
0
	def test_process_tsv(self):
		expect = {u'subs': [u'E84_Information_Carrier'], u'label': u'Man-Made Object', u'className': u'ManMadeObject', 
		u'subOf': u'E19_Physical_Object|E24_Physical_Man-Made_Thing', u'props': [], u'class': None, u'okay': u'1',
		u'desc': u'This class comprises physical objects purposely created by human activity.\\nNo assumptions are made as to the extent of modification required to justify regarding an object as man-made. For example, an inscribed piece of rock or a preserved butterfly are both regarded as instances of E22 Man-Made Object.'}
		fn = 'cromulent/data/crm_vocab.tsv'
		vocabData = model.process_tsv(fn)
		man_made = vocabData['E22_Man-Made_Object']
		self.assertEqual(expect, man_made)
示例#2
0
 def test_build_class(self):
     tsv = "ClassName_full\tclass\tClassName_py2\tClass Label\tClass Description\t\t1\t\n"
     fh = open('tests/temp.tsv', 'w')
     fh.write(tsv)
     fh.close()
     vocabData = model.process_tsv('tests/temp.tsv')
     model.build_class('ClassName_full', model.BaseResource, vocabData)
     from cromulent.model import ClassName_py2
     self.assertEqual('Class Description', ClassName_py2.__doc__)
     os.remove('tests/temp.tsv')
示例#3
0
 def test_process_tsv(self):
     expect = {
         u'subs': [u'E84_Information_Carrier'],
         u'label': u'Man-Made Object',
         u'className': u'ManMadeObject',
         u'subOf': u'E19_Physical_Object|E24_Physical_Man-Made_Thing',
         u'props': [],
         u'class': None,
         u'okay': u'1'
     }
     fn = 'cromulent/data/crm_vocab.tsv'
     vocabData = model.process_tsv(fn)
     man_made = vocabData['E22_Man-Made_Object']
     del man_made['desc']  # too long and volatile
     try:
         self.assertEqual(expect, man_made)
     except:
         expect[u'subs'] = []
         self.assertEqual(expect, man_made)
示例#4
0
 def test_process_tsv(self):
     expect = {
         u'subs': [u'E84_Information_Carrier'],
         u'label': u'Human-Made Object',
         u'className': u'HumanMadeObject',
         u'subOf': u'E19_Physical_Object|E24_Physical_Human-Made_Thing',
         u'props': [],
         u'class': None,
         u'okay': u'1'
     }
     fn = 'cromulent/data/crm_vocab.tsv'
     vocabData = model.process_tsv(fn)
     man_made = vocabData['E22_Human-Made_Object']
     del man_made['desc']  # too long and volatile
     # check subs specifically - could be coming from an extension
     if man_made['subs'] != expect['subs']:
         del man_made['subs']
         del expect['subs']
     self.assertEqual(expect, man_made)