Repository: oasis-open/cti-python-stix2

Issue:
Passing a list to Bundle constructor creates list within a list
Currently if you pass a list to the Bundle constructor it creates a list within a list: 

```json
        {
          "objects":
             [
               [
                   { },
                   { }
               ]
             ]
        }
```

If the first argument is a list, the constructor should just assign it to `objects`.

Comments:

Patch:
diff --git a/stix2/__init__.py b/stix2/__init__.py
index 392e947..25e160a 100644
--- a/stix2/__init__.py
+++ b/stix2/__init__.py
@@ -15,7 +15,8 @@ from .observables import (URL, AlternateDataStream, ArchiveExt, Artifact,
                           WindowsProcessExt, WindowsRegistryKey,
                           WindowsRegistryValueType, WindowsServiceExt,
                           X509Certificate, X509V3ExtenstionsType)
-from .other import (ExternalReference, GranularMarking, KillChainPhase,
+from .other import (TLP_AMBER, TLP_GREEN, TLP_RED, TLP_WHITE,
+                    ExternalReference, GranularMarking, KillChainPhase,
                     MarkingDefinition, StatementMarking, TLPMarking)
 from .sdo import (AttackPattern, Campaign, CourseOfAction, Identity, Indicator,
                   IntrusionSet, Malware, ObservedData, Report, ThreatActor,
diff --git a/stix2/bundle.py b/stix2/bundle.py
index 85be3e1..b598ceb 100644
--- a/stix2/bundle.py
+++ b/stix2/bundle.py
@@ -17,6 +17,9 @@ class Bundle(_STIXBase):
     def __init__(self, *args, **kwargs):
         # Add any positional arguments to the 'objects' kwarg.
         if args:
-            kwargs['objects'] = kwargs.get('objects', []) + list(args)
+            if isinstance(args[0], list):
+                kwargs['objects'] = args[0] + list(args[1:]) + kwargs.get('objects', [])
+            else:
+                kwargs['objects'] = list(args) + kwargs.get('objects', [])
 
         super(Bundle, self).__init__(**kwargs)


Test patch:
diff --git a/stix2/test/test_bundle.py b/stix2/test/test_bundle.py
index fc3e350..54d7080 100644
--- a/stix2/test/test_bundle.py
+++ b/stix2/test/test_bundle.py
@@ -92,3 +92,27 @@ def test_create_bundle_with_positional_args(indicator, malware, relationship):
     bundle = stix2.Bundle(indicator, malware, relationship)
 
     assert str(bundle) == EXPECTED_BUNDLE
+
+
+def test_create_bundle_with_positional_listarg(indicator, malware, relationship):
+    bundle = stix2.Bundle([indicator, malware, relationship])
+
+    assert str(bundle) == EXPECTED_BUNDLE
+
+
+def test_create_bundle_with_listarg_and_positional_arg(indicator, malware, relationship):
+    bundle = stix2.Bundle([indicator, malware], relationship)
+
+    assert str(bundle) == EXPECTED_BUNDLE
+
+
+def test_create_bundle_with_listarg_and_kwarg(indicator, malware, relationship):
+    bundle = stix2.Bundle([indicator, malware], objects=[relationship])
+
+    assert str(bundle) == EXPECTED_BUNDLE
+
+
+def test_create_bundle_with_arg_listarg_and_kwarg(indicator, malware, relationship):
+    bundle = stix2.Bundle([indicator], malware, objects=[relationship])
+
+    assert str(bundle) == EXPECTED_BUNDLE
diff --git a/stix2/test/test_markings.py b/stix2/test/test_markings.py
index c2e0276..ebfa480 100644
--- a/stix2/test/test_markings.py
+++ b/stix2/test/test_markings.py
@@ -4,7 +4,7 @@ import pytest
 import pytz
 
 import stix2
-from stix2.other import TLP_WHITE
+from stix2 import TLP_WHITE
 
 from .constants import MARKING_DEFINITION_ID