PERF: HDFStore unicode method (#16666) · pandas-dev/pandas@0281886 (original) (raw)

`@@ -387,6 +387,7 @@ def test_repr(self):

`

387

387

``

388

388

`with ensure_clean_store(self.path) as store:

`

389

389

`repr(store)

`

``

390

`+

store.info()

`

390

391

`store['a'] = tm.makeTimeSeries()

`

391

392

`store['b'] = tm.makeStringSeries()

`

392

393

`store['c'] = tm.makeDataFrame()

`

`@@ -418,8 +419,9 @@ def test_repr(self):

`

418

419

`# make a random group in hdf space

`

419

420

`store._handle.create_group(store._handle.root, 'bah')

`

420

421

``

421

``

`-

repr(store)

`

422

``

`-

str(store)

`

``

422

`+

assert store.filename in repr(store)

`

``

423

`+

assert store.filename in str(store)

`

``

424

`+

store.info()

`

423

425

``

424

426

`# storers

`

425

427

`with ensure_clean_store(self.path) as store:

`

`@@ -4407,11 +4409,11 @@ def test_multiple_open_close(self):

`

4407

4409

``

4408

4410

`# single

`

4409

4411

`store = HDFStore(path)

`

4410

``

`-

assert 'CLOSED' not in str(store)

`

``

4412

`+

assert 'CLOSED' not in store.info()

`

4411

4413

`assert store.is_open

`

4412

4414

``

4413

4415

`store.close()

`

4414

``

`-

assert 'CLOSED' in str(store)

`

``

4416

`+

assert 'CLOSED' in store.info()

`

4415

4417

`assert not store.is_open

`

4416

4418

``

4417

4419

`with ensure_clean_path(self.path) as path:

`

`@@ -4432,20 +4434,20 @@ def f():

`

4432

4434

`store1 = HDFStore(path)

`

4433

4435

`store2 = HDFStore(path)

`

4434

4436

``

4435

``

`-

assert 'CLOSED' not in str(store1)

`

4436

``

`-

assert 'CLOSED' not in str(store2)

`

``

4437

`+

assert 'CLOSED' not in store1.info()

`

``

4438

`+

assert 'CLOSED' not in store2.info()

`

4437

4439

`assert store1.is_open

`

4438

4440

`assert store2.is_open

`

4439

4441

``

4440

4442

`store1.close()

`

4441

``

`-

assert 'CLOSED' in str(store1)

`

``

4443

`+

assert 'CLOSED' in store1.info()

`

4442

4444

`assert not store1.is_open

`

4443

``

`-

assert 'CLOSED' not in str(store2)

`

``

4445

`+

assert 'CLOSED' not in store2.info()

`

4444

4446

`assert store2.is_open

`

4445

4447

``

4446

4448

`store2.close()

`

4447

``

`-

assert 'CLOSED' in str(store1)

`

4448

``

`-

assert 'CLOSED' in str(store2)

`

``

4449

`+

assert 'CLOSED' in store1.info()

`

``

4450

`+

assert 'CLOSED' in store2.info()

`

4449

4451

`assert not store1.is_open

`

4450

4452

`assert not store2.is_open

`

4451

4453

``

`@@ -4456,11 +4458,11 @@ def f():

`

4456

4458

`store2 = HDFStore(path)

`

4457

4459

`store2.append('df2', df)

`

4458

4460

`store2.close()

`

4459

``

`-

assert 'CLOSED' in str(store2)

`

``

4461

`+

assert 'CLOSED' in store2.info()

`

4460

4462

`assert not store2.is_open

`

4461

4463

``

4462

4464

`store.close()

`

4463

``

`-

assert 'CLOSED' in str(store)

`

``

4465

`+

assert 'CLOSED' in store.info()

`

4464

4466

`assert not store.is_open

`

4465

4467

``

4466

4468

`# double closing

`

`@@ -4469,11 +4471,11 @@ def f():

`

4469

4471

``

4470

4472

`store2 = HDFStore(path)

`

4471

4473

`store.close()

`

4472

``

`-

assert 'CLOSED' in str(store)

`

``

4474

`+

assert 'CLOSED' in store.info()

`

4473

4475

`assert not store.is_open

`

4474

4476

``

4475

4477

`store2.close()

`

4476

``

`-

assert 'CLOSED' in str(store2)

`

``

4478

`+

assert 'CLOSED' in store2.info()

`

4477

4479

`assert not store2.is_open

`

4478

4480

``

4479

4481

`# ops on a closed store

`

`@@ -4820,9 +4822,10 @@ def test_categorical(self):

`

4820

4822

`tm.assert_frame_equal(result, df2)

`

4821

4823

``

4822

4824

`# Make sure the metadata is OK

`

4823

``

`-

assert '/df2 ' in str(store)

`

4824

``

`-

assert '/df2/meta/values_block_0/meta' in str(store)

`

4825

``

`-

assert '/df2/meta/values_block_1/meta' in str(store)

`

``

4825

`+

info = store.info()

`

``

4826

`+

assert '/df2 ' in info

`

``

4827

`+

assert '/df2/meta/values_block_0/meta' in info

`

``

4828

`+

assert '/df2/meta/values_block_1/meta' in info

`

4826

4829

``

4827

4830

`# unordered

`

4828

4831

`s = Series(Categorical(['a', 'b', 'b', 'a', 'a', 'c'], categories=[

`