class TestHeaderSection(unittest.TestCase): def setUp(self): tags = Tags.fromtext(TESTHEADER) self.header = HeaderSection(tags) def test_get_acadver(self): result = self.header['$ACADVER'] self.assertEqual('AC1009', result) def test_get_insbase(self): result = self.header['$INSBASE'] self.assertEqual((0., 0., 0.), result) def test_getitem_keyerror(self): with self.assertRaises(KeyError): var = self.header['$TEST'] def test_get(self): result = self.header.get('$TEST', 'TEST') self.assertEqual('TEST', result) def test_contains(self): self.assertTrue('$ACADVER' in self.header) def test_not_contains(self): self.assertFalse('$MOZMAN' in self.header)
def setUp(self): tags = Tags.fromtext(TESTHEADER) self.header = HeaderSection(tags)