def test_compare_with_saved(reader_instance, join_data):
    """
    WILL CHANGE IF TEST DATA  in .txt FILES or CONFIG CHANGES!
    """
    bn = reader_instance.makeBlockNode(join_data)
    fname = os.path.join(os.path.dirname(__file__), 'geounitnode.pickle')
    # with(open(fname, 'wb')) as f:
    #     pickle.dump(bn.toDict(keep_attrs=bn.__slots__), f)
    sbn = GeounitNode.fromDict(pickle.load(open(fname, 'rb')))
    assert sbn == bn
Esempio n. 2
0
 def test_toDict(self, add_querydict, dpq_make):
     geocode_dict = {
         16: 'Block',
         12: 'Block_Group',
         11: 'Tract',
         5: 'County',
         2: 'State',
         1: 'US'
     }
     n1 = makeNode(d1,
                   '12',
                   geocode_dict=geocode_dict,
                   addsyn=False,
                   dpq_make=dpq_make,
                   querydict=add_querydict)
     ndict1 = n1.toDict(keep_attrs=n1.__slots__)
     n2 = GeounitNode.fromDict(ndict1)
     assert n1 == n2