def test_run_info_read(self): with temporary_file_path() as tmppath: with open(tmppath, 'w') as tmpfile: tmpfile.write('foo:bar\n baz :qux quux') ri = RunInfo(tmppath) self.assertEquals(ri.path(), tmppath) # Test get_info access. self.assertEquals(ri.get_info('foo'), 'bar') self.assertEquals(ri.get_info('baz'), 'qux quux') self.assertIsNone(ri.get_info('nonexistent')) # Test dict-like access. self.assertEquals(ri['foo'], 'bar') self.assertEquals(ri['baz'], 'qux quux')
def test_run_info_read(self): with temporary_file_path() as tmppath: with open(tmppath, 'w') as tmpfile: tmpfile.write('foo:bar\n baz :qux quux') ri = RunInfo(tmppath) self.assertEqual(ri.path(), tmppath) # Test get_info access. self.assertEqual(ri.get_info('foo'), 'bar') self.assertEqual(ri.get_info('baz'), 'qux quux') self.assertIsNone(ri.get_info('nonexistent')) # Test dict-like access. self.assertEqual(ri['foo'], 'bar') self.assertEqual(ri['baz'], 'qux quux')