|
@@ 570-584 (lines=15) @@
|
| 567 |
|
|
| 568 |
|
class Test_50_load_and_dump(TestBaseWithIOMultiFiles): |
| 569 |
|
|
| 570 |
|
def test_30_dump_and_load(self): |
| 571 |
|
TT.dump(self.dic, self.a_path) |
| 572 |
|
TT.dump(self.upd, self.b_path) |
| 573 |
|
|
| 574 |
|
self.assertTrue(os.path.exists(self.a_path)) |
| 575 |
|
self.assertTrue(os.path.exists(self.b_path)) |
| 576 |
|
|
| 577 |
|
res = TT.load(self.a_path) |
| 578 |
|
self.assert_dicts_equal(res, self.dic) |
| 579 |
|
|
| 580 |
|
res = TT.load(self.g_path) |
| 581 |
|
self.assert_dicts_equal(res, self.exp) |
| 582 |
|
|
| 583 |
|
res = TT.load([self.a_path, self.b_path]) |
| 584 |
|
self.assert_dicts_equal(res, self.exp) |
| 585 |
|
|
| 586 |
|
def test_31_dump_and_load__to_from_stream(self): |
| 587 |
|
with TT.open(self.a_path, mode='w') as strm: |
|
@@ 432-446 (lines=15) @@
|
| 429 |
|
|
| 430 |
|
class Test_40_multi_load_with_strategies(TestBaseWithIOMultiFiles): |
| 431 |
|
|
| 432 |
|
def _check_multi_load_with_strategy(self, exp, merge=TT.MS_DICTS): |
| 433 |
|
TT.dump(self.dic, self.a_path) |
| 434 |
|
TT.dump(self.upd, self.b_path) |
| 435 |
|
|
| 436 |
|
self.assertTrue(os.path.exists(self.a_path)) |
| 437 |
|
self.assertTrue(os.path.exists(self.b_path)) |
| 438 |
|
|
| 439 |
|
res0 = TT.multi_load(self.g_path, ac_merge=merge) |
| 440 |
|
res1 = TT.multi_load([self.g_path, self.b_path], ac_merge=merge) |
| 441 |
|
|
| 442 |
|
self.assertTrue(res0) |
| 443 |
|
self.assertTrue(res1) |
| 444 |
|
|
| 445 |
|
self.assert_dicts_equal(res0, exp) |
| 446 |
|
self.assert_dicts_equal(res1, exp) |
| 447 |
|
|
| 448 |
|
def test_10_default_merge_strategy(self): |
| 449 |
|
exp = copy.deepcopy(self.upd) |