docstr: Ensure objects that implement __geo_interface__ can be encoded into
  GeoJSON strings
docstr_tok: ["Ensure","objects","that","implement","__geo_interface__","can","be","encoded","into","GeoJSON","strings"]
code: def test_encode(self):
      """
      Ensure objects that implement __geo_interface__ can be encoded into
      GeoJSON strings
      """
      actual = geojson.dumps(self.restaurant1, sort_keys=True)
      self.assertEqual(actual, self.restaurant_str)
  
      actual = geojson.dumps(self.restaurant2, sort_keys=True)
      self.assertEqual(actual, self.restaurant_str)
  
      # Classes that don't implement geo interface should raise TypeError
      with self.assertRaises(TypeError):
          geojson.dumps(self.restaurant_nogeo)
  
file_path: geojson/tests/test_geo_interface.py
imports: import unittest
  import geojson
  from geojson.mapping import to_mapping
label_desc: Use image node_id 2 for calling the EncodingDecodingTest obj's underlying member method code with example usage: obj.test_encode() without return types