Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to test if a value is or is like a dictionary
i have a function that needs to test if a value given to it in an argument is a dictionary or not. doing isinstance(thevalue,dict) is not good enough when the value comes from os.environ. but i would want the test to be positive for os.environ and anything like it as well as any genuine dictionary. what kind of test would work?
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.

>>> import os >>> import >>> isinstance(os.environ, True >>> isinstance({}, True
Skaperen and buran like this post
Craig "Ichabod" O'Brien -
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures


Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Test Case Assertion Error moga2003 10 273 Mar-18-2019, 01:06 AM
Last Post: moga2003
  test pattern and add result in a table sam1975 1 79 Mar-05-2019, 02:41 PM
Last Post: sam1975
  new python package test ramkrishna 0 64 Feb-25-2019, 12:18 PM
Last Post: ramkrishna
  How to make loop go back to the beginning if test evaluaes to True. FWendeburg 1 112 Feb-13-2019, 01:26 AM
Last Post: stullis
  unit test roll die saladgg 5 533 Nov-06-2018, 11:39 PM
Last Post: stullis
  Having issues getting a multiple choice test program to work Py_JohnS 2 371 Sep-01-2018, 11:06 PM
Last Post: Py_JohnS
  Mix-in class tree file not running the self test code. arjunsingh2908 3 424 Aug-14-2018, 05:46 PM
Last Post: arjunsingh2908
  pytest fixture in thrown error while in the test file runs OzzieOzzum 1 371 Jul-31-2018, 12:12 PM
Last Post: OzzieOzzum
  code pattern to test if list has all the same Skaperen 5 555 Jul-25-2018, 06:09 AM
Last Post: buran
  Problem test picalex06 3 557 Jun-27-2018, 09:10 PM
Last Post: woooee

Forum Jump:

Users browsing this thread: 1 Guest(s)